surf function plotting temperature
조회 수: 7 (최근 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
댓글 수: 0
답변 (1개)
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.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!