surf function plotting temperature

4 次查看(过去 30 天)
The question is: Use Matlab to plot the temperature distribution in the slab, T(x,y)using 50terms of the series solution. Use the “surfc” command to plot the distribution as a surface with a contour map underneath. If you were going to put up asafety barricade, where would you recommend putting it?
My already generated equation is the Cn I have in the code. For some reason nothing is plotting though, any help? My code is below:
clear;
clc;
L = 25; % in m
W = 100; % in m
k = 0.5; % in W/mK
qs = 20; % in W/m2
N = 50;
T = zeros(N);
for c = 1:N
Cn = ((2*qs*L)/(k*(3.14^2)))*(((-1)^(c+1)+1)/((c^2)*cosh(c*3.14*W/L)))*sin(c*3.14*W/L)*sinh(c*3.14*W/L)
surf(T, Cn)
xlabel('Temperature')
ylabel('Cn Values')
title('Temperature v Cn Values')
end

回答(1 个)

Star Strider
Star Strider 2021-3-7
The surf function requires either one or three arguments, if three the first two are either vectors or matrices of the independent variables and the third is a matrix of the dependent variable.
Also, in the ‘Cn’ calculation, it is necessaary to use element-wise operations. See the documentation section on Array vs. Matrix Operations for details on that.

类别

Help CenterFile Exchange 中查找有关 Chemistry 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by