Have a problem about 3D graph

1 visualización (últimos 30 días)
Ratchapon Nilprapa
Ratchapon Nilprapa el 27 de Sept. de 2021
Comentada: Ratchapon Nilprapa el 1 de Oct. de 2021
I'm new in matlab and I have a problem to plot my 3D graph, please give me for any advise.
Ps. The graph code is below the last 'end'
clear all
clc
% find diffusion coefficients
R=8.314;
T=[600:50:800];
D=0.27*(1.04/-0.22)*exp((-246)./(R*T)); %(unit: cm^2*sec^-1)
% use D to find how far that carbon can diffusion
Cs=[0.15:0.15:0.45];
Cx=0.12;
C0= 0;
%Erf=(Cs-Cx)/(Cs-C0)
Erf=[0.2 0.6 0.7333];
z=NaN(size(Erf));
for n=1:numel(Erf)
if Erf(n)<2
z(n)=(-0.3725*Erf(n)^2)+(1.2144*(Erf(n)))+(0.0006);%and the rest the of the line
else
z(n)=(-0.0109*Erf(n)^2)+(0.0577*(Erf(n)))+(0.9235);%and the rest the of the line
end
end
%find X
X=z(n)*(2*sqrt(D*60));
%Graph 1
T=600:50:800;
X=z(n)*(2*sqrt(D*60));
[T,X]=meshgrid(T,X);
Cs=0.15:0.15:0.45;
mesh(T,X,Cs)
ylabel('diffusion coefficient (cm^2/sec^-1)','fontsize',18);
xlabel('temperature (°C)','fontsize',18);
zlabel('CarbonStart ,fontsize',18);
  2 comentarios
KSSV
KSSV el 27 de Sept. de 2021
You cannot plot like that. T, X is 5x5 matrix but Cs is 1x3 array. You need to rethink on what you have to plot.
Ratchapon Nilprapa
Ratchapon Nilprapa el 1 de Oct. de 2021
Thank you to your advise, KSSV.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Directed Graphs 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