![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/256973/image.png)
help!!! with plot
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Image Analyst
il 24 Dic 2019
Modificato: Image Analyst
il 24 Dic 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 Commenti
Più risposte (2)
Bhaskar R
il 24 Dic 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 Commenti
KSSV
il 24 Dic 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 Commenti
Vedere anche
Categorie
Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!