I'm trying to plot differential equations but it's showing errors.
11 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (1 件)
Ameer Hamza
2020 年 12 月 6 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Labels and Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!