Multiple facecolor in one fsurf plot

조회 수: 1 (최근 30일)
MINATI PATRA
MINATI PATRA 2023년 7월 23일
댓글: MINATI PATRA 2023년 7월 25일
M = 1; m = 0.1; n = 3; Pr = 3; Ec = 0.1; N = 0.5; lp = 0.01; Bi = 0.5; wf = 100; om = 0.1; %w1 = 10; w2 = 10;
syms w1 w2
for n = [3 3.7 5 5.7 8.9]
Cpf = 3594;rhof = 1063;kf = 0.492;Cps1 = 960;sigmaf = 4.3*(10^-5);rhos1 = 2810;ks1 = 173;sigmas1 = 26.77*10^6;Cps2 = 893;rhos2 = 2720;ks2 = 222;sigmas2 = 34.83*10^6;
phi1 = (w1/rhos1)./( (w1/rhos1) + (w2/rhos2) + (wf/rhof));
phi2 = (w2/rhos2)./( (w1/rhos1) + (w2/rhos2) + (wf/rhof)) ;
phi = phi1 + phi2;rhos = ((rhos1*w1) + (rhos2*w2))./(w1 + w2);Cps = ((Cps1 * w1) + (Cps2 * w2))./(w1 + w2);
A1 = (1-phi)^-2.5;A2 = ( 1- phi + phi*(rhos/rhof));A4 = ( 1- phi+phi*((rhos*Cps)/(rhof*Cpf)));
C1 = ( (ks1+(n-1)*kf-(n-1)*phi1*(kf-ks1))/(ks1+(n-1)*kf+phi1*(kf-ks1)) )*kf;
A3 = (ks2+(n-1)*C1-(n-1)*phi2*(C1-ks2))/(ks2+(n-1)*C1+phi2*(C1-ks2));
C2 = ( (sigmas1+2*sigmaf-2*phi1*(sigmaf-sigmas1))/(sigmas1+2*sigmaf+phi1*(sigmaf-sigmas1)))*sigmaf;
A5 = (sigmas2+2*C2-2*phi2*(C2-sigmas2))/(sigmas2+2*C2+phi2*(C2-sigmas2));
figure(1),fsurf(A3,[0 10 0 10],'LineWidth',2,'EdgeColor','none'), hold on,%view(30,30);
xlabel ('\bfw_1','color','blue','Fontsize',14,'FontWeight', 'bold'); ylabel ('\bfw_2','color','blue','Fontsize',10,'FontWeight', 'bold');
zlabel ('\bfk_{hnf}\k_f','color','blue','Fontsize',14,'FontWeight','bold'); axis on; box on; ax = gca; ax.BoxStyle = 'full'; ax.XAxis.LineWidth = 2; ax.YAxis.LineWidth = 2; ax.ZAxis.LineWidth = 2;
legend({'\color{green}\bfSpherical','\color{red}\bfBrick','\color{blue}\bfCylindrical','\color{black}\bfPlatelet','\color{magenta}\bfBlade'},'Box','off');
end
Warning: Ignoring extra legend entries.
Warning: Ignoring extra legend entries.
Warning: Ignoring extra legend entries.
Warning: Ignoring extra legend entries.
Warning: Error updating Text.

String scalar or character vector must have valid interpreter syntax:
\bfk_{hnf}\k_f
%%% %% I have TWO questions: (i) I want the values of w1 = w2 = 10 (fsurf(A3,[0 10 0 10]), IS THIS RIGHT?) to run the fsurf plot
%% (ii) I need 5 different facecolor in one plot as given in legend

채택된 답변

Walter Roberson
Walter Roberson 2023년 7월 23일
편집: Walter Roberson 2023년 7월 23일
M = 1; m = 0.1; n = 3; Pr = 3; Ec = 0.1; N = 0.5; lp = 0.01; Bi = 0.5; wf = 100; om = 0.1; %w1 = 10; w2 = 10;
syms w1 w2
facecolors = {'g', 'r', 'b', 'k', 'm'};
nvalues = [3 3.7 5 5.7 8.9];
for nidx = 1:length(nvalues)
n = nvalues(nidx);
Cpf = 3594;rhof = 1063;kf = 0.492;Cps1 = 960;sigmaf = 4.3*(10^-5);rhos1 = 2810;ks1 = 173;sigmas1 = 26.77*10^6;Cps2 = 893;rhos2 = 2720;ks2 = 222;sigmas2 = 34.83*10^6;
phi1 = (w1/rhos1)./( (w1/rhos1) + (w2/rhos2) + (wf/rhof));
phi2 = (w2/rhos2)./( (w1/rhos1) + (w2/rhos2) + (wf/rhof)) ;
phi = phi1 + phi2;rhos = ((rhos1*w1) + (rhos2*w2))./(w1 + w2);Cps = ((Cps1 * w1) + (Cps2 * w2))./(w1 + w2);
A1 = (1-phi)^-2.5;A2 = ( 1- phi + phi*(rhos/rhof));A4 = ( 1- phi+phi*((rhos*Cps)/(rhof*Cpf)));
C1 = ( (ks1+(n-1)*kf-(n-1)*phi1*(kf-ks1))/(ks1+(n-1)*kf+phi1*(kf-ks1)) )*kf;
A3 = (ks2+(n-1)*C1-(n-1)*phi2*(C1-ks2))/(ks2+(n-1)*C1+phi2*(C1-ks2));
C2 = ( (sigmas1+2*sigmaf-2*phi1*(sigmaf-sigmas1))/(sigmas1+2*sigmaf+phi1*(sigmaf-sigmas1)))*sigmaf;
A5 = (sigmas2+2*C2-2*phi2*(C2-sigmas2))/(sigmas2+2*C2+phi2*(C2-sigmas2));
fsurf(A3,[0 10 0 10],'LineWidth',2,'EdgeColor','none', 'facecolor', facecolors{nidx} );
hold on
end
view(30,30);
xlabel ('$\textbf{w}_1$','color','blue','Fontsize',14,'FontWeight', 'bold', 'interpreter', 'latex');
ylabel ('$\textbf{w}_2$','color','blue','Fontsize',10,'FontWeight', 'bold', 'interpreter', 'latex');
zlabel ('$\textbf{k}_{hnf}\textit{f}$','color','blue','Fontsize',14,'FontWeight','bold', 'interpreter', 'latex');
axis on; box on;
ax = gca;
ax.BoxStyle = 'full';
ax.XAxis.LineWidth = 2;
ax.YAxis.LineWidth = 2;
ax.ZAxis.LineWidth = 2;
legend({'\color{green}\bfSpherical','\color{red}\bfBrick','\color{blue}\bfCylindrical','\color{black}\bfPlatelet','\color{magenta}\bfBlade'},'Box','off');
I had to make some guesses about what you were trying to do with the labels, I could not figure out the \k_f -- I had to guess italics.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by