5.4k views
2 votes
Create a function (prob3_5) that will take inputs of vectors x and y in feet, scalar N, scalars L and W in feet and scalars T1 and T2 in degrees Fahrenheit. It will output a matrix T which is the temperature of each x and y locations. T will have the number of columns equal to the number of elements in x and rows equal to the number of elements in y. Though this can be done without loops (perhaps more efficiently), your program must use a nested loop.

1 Answer

6 votes

Answer:

clear, clc

prob3_5([1,2,3],[6,5,7],12,11,22,55,76)

function T=prob3_5(x,y,N,L,W,T1,T2)

w=zeros(1,length(x));

for n=1:2:N

for i=1:length(x)

w(i)=w(i)+(2/pi)*(2/n)*sin(n*pi*x(i)/L).*sinh(n*pi*y(i)/L)/sinh(n*pi*W/L);

end

end

T=(T2-T1)*w+T1;

end

Step-by-step explanation:

Please input the commands into MATLAB

User Asfar Irshad
by
3.8k points