Matlab plotting of a trapezoidal cuve
2 visualizaciones (últimos 30 días)
Hello.. I want to plot a trapezoidal curve which is attached here. For that I have written following code but while plotting the value of pressure is not coming as a vector it is giving only a vector of only five value.I am not getting where is my fault plz help....
if (t(m)>= 0) && (t(m) <= t1)
elseif(t(m)>= t1) && (t(m) <= t2)
elseif(t(m)>= t2) && (t(m) <= t3)
elseif(t(m)>= t3) && (t(m) <= t4)
Satyajeet Sasmal el 15 de Dic. de 2015
I assume that you want to plot (p,t). But p just has 2 elements and that is why it does not allow it to be plotted against "t". You only get 2 values for p because the control inside the for-loop does not execute some of the if-elseif conditions. In fact, it only enters the if-elseif condition block on only 2 occasions and so you get only 2 values for p. Try giving an else condition to the if-elseif block and assign some value to p in such cases. Once "p" and "t" are the same length, you should be able to plot them.