the plot is not appearing what should i fix ?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
g=9.81;
Flow = app.FlowEditField.Value;
Width = app.WidthEditField.Value;
q = Width/Flow;
yc=(q^2/g)^(1/3);
Criticaldepth = app.CriticalDepthEditField.Value;
app.CriticalDepthEditField.Value = [num2str(yc)];
Depth = app.DepthEditField.Value;
for i=1:length(Depth)
E(i)=Depth(i)+q^2/(2*g*Depth(i)^2);
plot(app.UIAxes,E,Depth,'r');
end
0 commentaires
Réponses (1)
Walter Roberson
le 5 Août 2022
for i=1:length(Depth)
E(i)=Depth(i)+q^2/(2*g*Depth(i)^2);
end
plot(app.UIAxes,E,Depth,'r');
However, the convention is that the independent variable (Depth in this case) should be on the horizontal axes (first data parameter) and that the dependent variable (E in this case) should be on the vertical axes. It will be confusing to people that you have those reversed.
Note: instead of the loop you could vectorize to
E = Depth + q^2 ./ (2*g*Depth.^2);
0 commentaires
Voir également
Catégories
En savoir plus sur Graphics Objects dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!