
for loops, how to see the effect of a parameter
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Simplified version of moy code is somethig like this:
theta=2;
beta=8;
W=30;
bound=W./(theta+beta)
step=bound/1000;
R=[0:step:bound];
V=R.^2+3*theta+beta*W;
figure; plot(R,V); xlabel('R'); ylabel('V');
I would like to see the effect of theta. So for example theta= [2 4 6 ] Since bound, hence R range, depend on theta, the for loops or functions I write are not working. Any help on how to write the code is appreciated
0 Commenti
Risposte (1)
KALYAN ACHARJYA
il 16 Mar 2018
theta=2;
beta=8;
W=30;
bound=W./(theta+beta)
step=bound/1000;
R=[0:step:bound];
for theta=theta:10 % you can change this range
V=R.^2+3*theta+beta*W;
plot(R,V);
hold on;
theta=theta+2;
end
xlabel('R'); ylabel('V');
hold off;

Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements 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!