Filter löschen
Filter löschen

Im trying to plot two functions over a range

1 Ansicht (letzte 30 Tage)
ali altaif
ali altaif am 3 Jul. 2022
Beantwortet: Star Strider am 3 Jul. 2022
trying to plot two functions over a range
But only one function gives me correct values
The other one just gives one value
x=[0.2:0.1:0.7];
y1=1/((x/400 +(1-x)/80)(1/x+(0.5(1-x))))
y2 =1/(1/40)(1-x)+(1/400)(x)
what ami doing wrong

Akzeptierte Antwort

Star Strider
Star Strider am 3 Jul. 2022
There are several missing operators (that I assume should be multiplication operators), and all the applidable operators should be element-wise, so (.*) instead of (*) and (./) instead of (/).
x=[0.2:0.1:0.7];
y1=1./((x/400 +(1-x)/80) .* (1./x+(0.5.*(1-x))));
y2 =1./(1/40) .* (1-x)+(1./400).*(x);
figure
plot(x, y1, x, y2)
grid
legend('y_1','y_2', 'Location','best')
.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Performance finden Sie in Help Center und File Exchange

Produkte


Version

R12.1

Community Treasure Hunt

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

Start Hunting!

Translated by