![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/256973/image.png)
help!!! with plot
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Qiandong Dong
am 24 Dez. 2019
Beantwortet: KSSV
am 24 Dez. 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 Kommentare
Akzeptierte Antwort
Image Analyst
am 24 Dez. 2019
Bearbeitet: Image Analyst
am 24 Dez. 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;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/256973/image.png)
0 Kommentare
Weitere Antworten (2)
Bhaskar R
am 24 Dez. 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 Kommentare
KSSV
am 24 Dez. 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 Kommentare
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!