error while using ezplot

2 ビュー (過去 30 日間)
Seungwon Lee
Seungwon Lee 2020 年 4 月 11 日
コメント済み: Ameer Hamza 2020 年 4 月 12 日
ezplot('((5.14*10^(-4))-(6.44*10^(-5)*i))*exp(5*i*t)+exp(-0.796*t)*(0.99+6.44*10^(-5)*i)*cos(7.96*t)+exp(-0.796*t)*(-0.099-3.29*10^(-4)*i)*sin(7.96*t)',[0,20])
nothing appears when i use ezplot i dont know why

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 4 月 11 日
編集済み: Ameer Hamza 2020 年 4 月 11 日
You equation returns numbers with both real and imaginary parts. Following code plots both
f = @(t) ((5.14*10^(-4))-(6.44*10^(-5)*1i)).*exp(5*1i*t)+exp(-0.796*t).*(0.99+6.44*10^(-5)*1i).*cos(7.96*t)+exp(-0.796*t).*(-0.099-3.29*10^(-4)*1i).*sin(7.96*t);
t = linspace(0,20,1000);
f_value = f(t);
subplot(2,1,1);
plot(t, real(f_value))
title('real');
subplot(2,1,2);
plot(t, imag(f_value))
title('imaginary');
  2 件のコメント
Seungwon Lee
Seungwon Lee 2020 年 4 月 12 日
thanks for answering Ameer Hamza. Can you tell me the meaning of @(t) in the fist line?
Ameer Hamza
Ameer Hamza 2020 年 4 月 12 日
This is a way to define an anonymous function. It is used to define simple functions without using a function block. If you have experience with other programming languages, then you can think of its as a lambda function.

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

その他の回答 (1 件)

Geoff Hayes
Geoff Hayes 2020 年 4 月 11 日
Seungwon - try using fplot instead which is recommended to be used instead of ezplot. Note that when I run your code with ezplot, nothing shows up for me either....yet it does work with fplot.
  1 件のコメント
Seungwon Lee
Seungwon Lee 2020 年 4 月 12 日
Sorry but nothing appears eventhough i changed ezplot to fplot. Does it work on yours?

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

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by