surf function plotting temperature

6 visualizaciones (últimos 30 días)
kileigh palmer
kileigh palmer el 7 de Mzo. de 2021
Respondida: Star Strider el 7 de Mzo. de 2021
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

Respuestas (1)

Star Strider
Star Strider el 7 de Mzo. de 2021
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.

Categorías

Más información sobre Chemistry en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by