MATLAB Answers

error while using ezplot

조회 수: 3(최근 30일)
Seungwon Lee
Seungwon Lee 2020년 4월 11일
댓글: Ameer Hamza 2020년 4월 12일
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);
plot(t, real(f_value))
plot(t, imag(f_value))
  댓글 수: 2
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?

댓글을 달려면 로그인하십시오.


Community Treasure Hunt

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

Start Hunting!

Translated by