x = 1:10:100;
y = (((20*x+35000)/(70))-1)/x;
plot(x,y)
I was wondering why the above code does not plot the function, y? As soon as the x is put in the denominator the function refuses to plot.

2 commentaires

Try
./
Instead of
/
y = (((20*x+35000)/(70))-1)./x;
^^ you need this!
You need to learn about array and matrix operations:

Connectez-vous pour commenter.

 Réponse acceptée

madhan ravi
madhan ravi le 9 Sep 2018
Modifié(e) : madhan ravi le 9 Sep 2018

0 votes

Use element wise operation because as you defined x as a vector you should use dot it means each element is calculated one by one.
x = 1:10:100;
y = (((20*x+35000)/(70))-1)./x;
plot(x,y)

1 commentaire

madhan ravi
madhan ravi le 9 Sep 2018
Modifié(e) : madhan ravi le 9 Sep 2018
if it solved the issue, please accept the answer

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by