clc , clear ;m=2 ; k=28 ; tinf1=20 ; h1=500 ; tinf2=30 ; h2=15; l=pi ; alpha=4*10^-4 ; dx=1/m ;dt=200 ; taw=(dt*alpha)/(dt)^2 ;treq=1800 ; imax=( treq /dt)+1;t1=700-50*sin(dx);t=zeros(imax,m+1);t(1,:)=zeros(1,m+1)+t1 ;for i=1: imax-1 ; for m=1:m+1 ; if m==1 t(i+1,m)=taw*t(i,m+1)-(t(i,m)*(taw+h1*dx)); else if m==m t(i+1,m)=taw*t(i,m+2)-(t(i,m+1)*(taw+h2*dx)); else t(i+1,m)=taw*(t(i,m-1)-2*t(i,m+1)+t(i,m)); end end endendts=t(:,m+1) ; time=linspace(0,treq , length(ts))
MATLAB: Attempted to access t(1,4); index out of bounds because size(t)=[10,3] , how to solve this problem
heat transfer
Best Answer