Surface Plot for ODE solution
显示 更早的评论
How can I make a surface plot for the ODE solution for different constants z?
w = 1;
k=1;
figure
tspan = [0 5];
for z=0.1:0.01:0.5
f = @(t,x) [-1i.*(2*w + 2*z).*x(1) + -1i.*sqrt(2).*k.*x(2);-1i.*sqrt(2).*k.*x(1) + -1i.*2*w*x(2)+-1i.*sqrt(2).*k.*x(3);-1i.*sqrt(2).*k.*x(2)+-1i.*2*w*x(3)];
[t,xa] = ode45(f,tspan,[0 1 0]);
gs = abs(xa).^2;
surf(t,z,gs(:,2))
end
2 个评论
T K
2022-12-7
Please, when I run this code, this problem appears.
Error in Untitled7 (line 15)
surf(t,zv,gs2')

@T K — Check to see if you have a variable or user function called ‘surf’ by running this from a script or your Command Window —
which surf -all
It should give only this result. If it returns anything else, that points to the problem. The solution is to rename the other function or variable.
.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Map Display 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!