Help with 3D plotting

1 Ansicht (letzte 30 Tage)
Devon Von Lichtenstein
Devon Von Lichtenstein am 3 Apr. 2018
I have an assignment to plot a 3D grid showing temperature changes with 3 sides starting at 0 degrees and one side being 80 degrees. The box is supposed to be 5x4 and the temperature change is expressed with a Fourier series.
Right now I'm getting a flat grid with only x and y. I feel like I'm missing something with how I created the Fourier series (specifically T) and obviously with how it's being plotted. I'm not asking for the exact answer, but would appreciate some help with where to go from here:
a = 5; %x length
b = 4; %y length
T1 = 80; %max temp
x = 1:1:5;
y = 0:1:4;
[X Y] = meshgrid(x,y);
for n=1:50
A = sin(2*n-1)*(pi*X/a); %first part of Fourier
B = sinh(2*n-1)*(pi*Y/a); %second part of Fourier
C = (2*n-1)*sinh((2*n-1)*(pi*b/a)); %denomenator of Fourier
Z = (A*B/C);
end
T(x,y) = (4*T1/pi)*Z ; %adding the (x,y) gives me an error but was told that is how it should be written
surf(X,Y,Z)
grid on
end

Antworten (0)

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by