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

11 ビュー (過去 30 日間)
Suraj Narayan
Suraj Narayan 2020 年 12 月 6 日
コメント済み: Suraj Narayan 2020 年 12 月 6 日
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

回答 (1 件)

Ameer Hamza
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 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 12 月 6 日
Which MATLAB release are you using?
Suraj Narayan
Suraj Narayan 2020 年 12 月 6 日
2016a

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLabels and Annotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by