
Plot doesn't show in figure
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
For my study I need to learn to work with MatLab and we just started using for loop. Now I tried making a diagram with volume at the x-axis and pressure at the y-axis, using XSteam.
T_iso=[400, 600, 800] %vector with isotherms
for T=T_iso
for i = (1:1:15) %assignment told to use i for pressure (pressure in MPa)
v=XSteam('v_pT', i, T) %calculating v, using XSteam
end
plot(v,i) %trying to plot
end
Everything goes well, until I try to plot this. I do get a figure window with the right values on both the axes, but it does not show any lines or something. Does anyone know how to solve this? Thanks a lot!
Sabine
0 comentarios
Respuestas (1)
Stephen23
el 16 de Dic. de 2016
Editada: Stephen23
el 16 de Dic. de 2016
The plot does not show anything because you are not actually plotting anything. You need to use indexing in the loop to store the values that are being calculated, otherwise they will simply get overwritten, and when you go to plot there is nothing to plot. Try this:
I_vec = 1:15;
T_iso = [400,600,800]; % isotherms
% preallocate output matrix:
out = NaN(numel(I_vec),numel(T_iso));
% loop over input vectors:
for ix = 1:numel(I_vec)
for tx = 1:numel(T_iso)
out(ix,tx) = XSteam('v_pT', I_vec(ix), T_iso(tx));
end
end
%
plot(out)

0 comentarios
Ver también
Categorías
Más información sobre Graphics Performance 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!