How to smooth out a surf plot

4 visualizaciones (últimos 30 días)
Tigist Beyene
Tigist Beyene el 20 de En. de 2020
Respondida: KSSV el 20 de En. de 2020
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

Respuestas (1)

KSSV
KSSV el 20 de En. de 2020
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.

Categorías

Más información sobre Characters and Strings 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