Am I using fplot correct?

1 view (last 30 days)
Seungwon Lee
Seungwon Lee on 23 Apr 2020
Commented: Star Strider on 23 Apr 2020
syms x
y1 = 0.35*exp(-3*x)-0.15*exp(3*x)
fplot(y1,[-10,10])
hold on
y2 = 0.2*cos(3*x)-0.5*sin(3*x)
fplot(y2,[-10,10])
legend('y1','y2')
I want to know if graph y1, y2 are equal so i want to compare them.
But when i execute this code y2 seems to be y=0
help please

Accepted Answer

Star Strider
Star Strider on 23 Apr 2020
The y-axis scales are significantly different, so ‘y2’ will appear to be 0 when it actually is not. Multiply ‘y2’ by a suitably large constant to make it visible:
syms x
y1 = 0.35*exp(-3*x)-0.15*exp(3*x)
fplot(y1,[-1,1]*10)
hold on
y2 = 0.2*cos(3*x)-0.5*sin(3*x)
fplot(y2*1E+11,[-1 1]*10)
hold off
legend('y1','y2\times10^{11}')
.
  2 Comments
Seungwon Lee
Seungwon Lee on 23 Apr 2020
thank you
Star Strider
Star Strider on 23 Apr 2020
As always, my pleasure!

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!