Wrong graph is coming with this code
    8 次查看(过去 30 天)
  
       显示 更早的评论
    
function main
A=0.5; pr=1; a=1; phi=0.1;rhos=997.1;Cps=4179;ks=0.613;rhof=8933;Cpf=385;kf=401; 
a1=(1-phi)^-2.5*((1-phi)+phi*(rhos/rhof));  Knf=(ks+2*kf-2*phi*(kf-ks))/(ks+2*kf+phi*(kf-ks));
a2=((1-phi)+phi*((rhos*Cps)/(rhof*Cpf)))*Knf;
xa = 0;xb = 5;solinit=bvpinit(linspace(xa,xb,101),[0 1 0 a 1 0 0 0]);
sol = bvp4c(@ode,@bc,solinit); x = linspace(xa,xb,101);S = deval(sol,x);
function res = bc(ya,yb)
res = [ya(1); ya(2)-1; ya(4); ya(5)-a; ya(7)-1; yb(2); yb(5); yb(7)];
end 
function dydx = ode(~,y)    
dydx = [y(2);  y(3);  2*a1*y(2)*(y(2)+y(5))-a1*y(3)*(y(1)+y(4));  
        y(5);  y(6);  2*a1*y(5)*(y(2)+y(5))-a1*y(6)*(y(1)+y(4));
        y(8);  A*pr*a2*y(7)*(y(2)+y(5))-pr*a2*y(8)*(y(1)+y(4))];              
end
figure(14)
f1 = @(x,y) S(2);
fsurf(f1)
xlabel '\bfx';ylabel '\bfy';zlabel '\bff^\prime(\eta)'
hold on
end
%% The graph is not obeying Boundary Condition
%% I am trying graphs like Fig. (14)  and  another  is contour (Attached)
采纳的回答
  Star Strider
      
      
 2020-8-26
        Using fsurf is not appropriate here.  
Try this instead: 
figure(14)
hs = surf(S);
grid on
xlabel '\bfx';ylabel '\bfy';zlabel '\bff^\prime(\eta)'
% shading('interp')                                               % Optional
% hs.EdgeColor = 'none';                                          % Optional
That produces this plot: 

I am not certain what the reference to ‘S(2)’ is suposed to do, beccause ‘S’ is a matrix.  This plots the entire matrix.  
.
6 个评论
  Star Strider
      
      
 2020-8-27
				Thank you!  
Your ccode does not produce the plot in the .PDF file.  I have no idea what you are doing.  
You can use essentially the same code to create the contour plot as the surf plot.  Just call contour instead of surf, and remove the zlabel and view calls.  
As always, my pleasure!  
更多回答(0 个)
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Graphics Performance 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


