help!!! with plot
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Qiandong Dong
el 24 de Dic. de 2019
Respondida: KSSV
el 24 de Dic. de 2019
clear all
a=200;b=5;cm=10;cr=3;v=600;k=6;u=0.1;s=0.2;e=2;cp=2;t=1;
pr=1:10;
r=-(pr*u*(b*cm - a + cp*e*k + b*cp*e*t))/(8*v + 2*b*pr.^2*u - 2*b*cm*pr*u + 2*b*cr*pr*u - 2*b*pr.^2*s*u);
plot(r)
Why just plot a point, not a line?
0 comentarios
Respuesta aceptada
Image Analyst
el 24 de Dic. de 2019
Editada: Image Analyst
el 24 de Dic. de 2019
Because you used slash (matrix division) instead of dot slash (element-by-element division). Try it this way:
clear all
a=200;
b=5;
cm=10;
cr=3;
v=600;
k=6;
u=0.1;
s=0.2;
e=2;
cp=2;
t=1;
pr=1:10;
r=-(pr*u*(b*cm - a + cp*e*k + b*cp*e*t)) ./ (8*v + 2*b*pr.^2*u - 2*b*cm*pr*u + 2*b*cr*pr*u - 2*b*pr.^2*s*u);
plot(r, 'bs-', 'LineWidth', 2)
grid on;
0 comentarios
Más respuestas (2)
Bhaskar R
el 24 de Dic. de 2019
MATLAB operator "/" performs linear equation solver, apply dot elemetwise(./) division
clear;
a=200;b=5;cm=10;cr=3;v=600;k=6;u=0.1;s=0.2;e=2;cp=2;t=1;
pr=1:10;
r=-(pr*u*(b*cm - a + cp*e*k + b*cp*e*t))./(8*v + 2*b*pr.^2*u - 2*b*cm*pr*u + 2*b*cr*pr*u - 2*b*pr.^2*s*u);
plot(r)
0 comentarios
KSSV
el 24 de Dic. de 2019
a=200;b=5;cm=10;cr=3;v=600;k=6;u=0.1;s=0.2;e=2;cp=2;t=1;
pr=1:10;
r=-(pr*u*(b*cm - a + cp*e*k + b*cp*e*t))./(8*v + 2*b*pr.^2*u - 2*b*cm*pr*u + 2*b*cr*pr*u - 2*b*pr.^2*s*u);
plot(r)
Element by element divison is needed.
/ is replaced with ./.
0 comentarios
Ver también
Categorías
Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!