I'm trying to plot differential equations but it's showing errors.

1 Ansicht (letzte 30 Tage)
Suraj Narayan
Suraj Narayan am 6 Dez. 2020
Kommentiert: Suraj Narayan am 6 Dez. 2020
Here is the code.....
clc
clear all
close all
syms i(t)
di = diff(i);
d2i = diff(i,2);
z = dsolve((d2i+40*di+1000*i(t)) == 0.1*diff(heaviside(t)));
i(0)==4;
di(0)==15;
z1 = diff(z); % ANS OF BIT a
subplot(2,1,1)
ezplot(z)
title('STEP RESPONCE')
xlabel('time (t)');
ylabel('(z)');
grid on;
gtext('1841014009');
subplot(2,1,2)
ezplot(z1)
title('IMPLUSE RESPONCE')
xlabel('time (t)');
ylabel('(z1)');
grid on;
gtext('1841014009');
And here is the errors
Please help me to solve this problem

Antworten (1)

Ameer Hamza
Ameer Hamza am 6 Dez. 2020
You are not applying the initial condition with solving the ode. Check the following code
clc
close all
syms i(t)
di = diff(i);
d2i = diff(i,2);
cond = [i(0)==4; di(0)==15];
z = dsolve((d2i+40*di+1000*i(t)) == 0.1*diff(heaviside(t)), cond);
z1 = diff(z); % ANS OF BIT a
subplot(2,1,1)
fplot(z)
title('STEP RESPONCE')
xlabel('time (t)');
ylabel('(z)');
grid on;
gtext('1841014009');
subplot(2,1,2)
fplot(z1)
title('IMPLUSE RESPONCE')
xlabel('time (t)');
ylabel('(z1)');
grid on;
gtext('1841014009');
Also, fplot() is recommended instead of ezplot().
  3 Kommentare
Ameer Hamza
Ameer Hamza am 6 Dez. 2020
Which MATLAB release are you using?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Labels and Annotations finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by