how can i plot for loop data?
Mostrar comentarios más antiguos
Hello everyone, I working in this heat transfer problem, but my question is about matlab code.
k=0.5; rho=2023; cv=1825; aLf=k/(rho*cv); L=0.25; nx=10; nxp=nx+1; dx=L/nx; td=12*3600; Tt=2*td;nt=60;ntp=nt+1;nTp=2*ntp;dt=td/nt; Tsd=20; Tsn=0; Ti=10; t=linspace(0,td,ntp);y=linspace(0,Tt,nTp); T1=zeros(1,ntp);T2=zeros(1,ntp); T1(1)=Ti;Tni=zeros(1,nxp); Tnii=zeros(1,nxp);
for i=1:nxp depth(i)=i*dx; for j=2:ntp time(j)= j*dt; Tx=Tsd+((Ti-Tsd)*(erf(depth(i)/(2*sqrt(aLf*(time(j))))))); T1(j)=Tx; end
subplot(223); plot(t,T1); hold on; xlabel('time (t)'); ylabel('Temperature(Tx)');grid on Tni(i)=Tx; end
time2=time; time2(1)=1;
for k=1:nxp depth(k)=k*dx; for r=1:ntp Ty=Tsn+((Tni(k)-Tsn)*(erf(depth(k)/(2*sqrt(aLf*(time2(r))))))); T2(r)=Ty; end Tnii(k)=Ty; subplot(224); plot(t,T2); hold on; xlabel('time (t)'); ylabel('Temperature(Tx)');grid on end
T=[T1,T2]; subplot(211); plot(y,T); hold on; xlabel('time (t)'); ylabel('Temperature(Tx)');grid on

my question is about the top or the first graph, its spouse to be same amount of line as in other two graph but its just drawing the last value.
can someone please help me how can i fix this, so that i can the bottom two graph into one graph.
i hope i make clear myself. Thanks in advance
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
