Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
plotting in matlab what should i do?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I want to plot x vs w, from the following code, but I'm not getting the correct plot. Could you explain it for me??
function[x]=packegingsystems(w,k1,k2,d)
if w<(k1*d)
x=w/k1;
else
x=(w+2*k2*d)/(k1+2*k2);
end
display(x)
and my attempt to plotting it:
w=linspace(0,3000,300)
x=packegingsystems(w,1e4,1.5e4,0.1)
plot(w,x)
This is not correct, the plot should consist of two ranges; as defined in the function file.
3 comentarios
Respuestas (1)
Image Analyst
el 6 de Mayo de 2015
Try this:
function x = packegingsystems(w,k1,k2,d)
x=(w+2*k2*d)/(k1+2*k2);
indexes = w < (k1*d); % Logical index.
x(indexes) = w(indexes) / k1;
0 comentarios
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!