Graph plot always appears as a straight line
Mostrar comentarios más antiguos
Hi, I don't know how to fix this. y graph looks like a straight line instead of an exponential curve. Please help me.. thanks a lot in advance !
l=0.5;
i=22/7;
v=0.8;
p=0.1;
x=[0:0.2:1.0];
y=(p*r^4*x)/(8*v*l);
plot(x,y)
5 comentarios
What is r ?
Your function of x looks linear because it is linear in x:
y=(p*r^4*x)/(8*v*l);
% ^ independent variable
The independent variable x is to the power 1, which is linear. I don't see why you expect a non-linear curve from power 1.
Abhinandana R
el 23 de En. de 2019
Stephen23
el 23 de En. de 2019
"y varies according to r"
But what you calculated is y varing with x.
Abhinandana R
el 23 de En. de 2019
madhan ravi
el 23 de En. de 2019
see Rik Wisselink’s answer below
Respuesta aceptada
Más respuestas (1)
Kevin Phung
el 23 de En. de 2019
Editada: Kevin Phung
el 23 de En. de 2019
0 votos
if r is a constant, you will get a straight line. if r varies, then you will get a curve.
also, you may want to add a period before your raising to a power and multiplcation for non-scalars.
so .^ and .*
Categorías
Más información sobre Line Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

