# Am I using fplot correct?

1 visualizzazione (ultimi 30 giorni)
Seungwon Lee il 23 Apr 2020
Commentato: Star Strider il 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
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Star Strider il 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 CommentiMostra NessunoNascondi Nessuno
Seungwon Lee il 23 Apr 2020
thank you
Star Strider il 23 Apr 2020
As always, my pleasure!

Accedi per commentare.

### Categorie

Scopri di più su MATLAB in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by