How to smooth out a surf plot

8 次查看(过去 30 天)
Tigist Beyene
Tigist Beyene 2020-1-20
回答: KSSV 2020-1-20
I want a nice and smooth surface. Can someone please give me some hints ?
clear
zspan = linspace(0,2,100);
v2in_vals = linspace(0.01,0.05,10);
v0mat = [1 0.1 1];
N = size(v0mat, 1);
zsol = cell(N,1);
v1sol = cell(N,1);
v2sol = cell(N,1);
v3sol = cell(N,1);
v2in = cell(N,1);
for k=1:length(v2in_vals)
v0 = v0mat;
v0(2) = v2in_vals(k);
[z,v] = ode45(@rhs,zspan,v0);
zsol{k} = z;
v1sol{k} = v(:,1);
v2sol{k} = v(:,2);
v3sol{k} = v(:,3);
v2in{k} = v0mat(2) * ones(size(v2sol{k}));
end
all_z = [zsol{:}];
all_v2 = [v2sol{:}];
all_v2in = [v2in{:}];
v2in_vec = v2in_vals;
z_vec = all_v2(:,2);
surf(z_vec, v2in_vec, all_v2.')
xlabel('z');
ylabel('dw');
zlabel('w');
function parameters=rhs(z,v)
alpha=0.116;
db= 2*alpha-(v(1).*v(3))./(2*v(2).^2);
dw= (v(3)./v(2))-(2*alpha*v(2)./v(1));
dgmark= -0.01-(2*alpha*v(3)./v(1));
parameters=[db;dw;dgmark];
end

回答(1 个)

KSSV
KSSV 2020-1-20
surf(z_vec, v2in_vec, all_v2.')
Increase the dimensions of z_vec and v2in_vec. Make the difference/ step size small to increase the dimensions.

类别

Help CenterFile Exchange 中查找有关 Design, Analysis, Benchmarking, and Verification 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by