我正在使用MATLAB來繪製洛倫茲吸引子並想知道如何將XYZ座標導出到3D可打印文件!從XYZ座標轉換到曲面我遇到了麻煩(我應該這樣做嗎?)。另外,即使將洛倫茲吸引子看作「表面」似乎也不適合我,因爲我的理解是它更像是一條「路徑」。到目前爲止我的代碼:使用MATLAB打印洛倫茲吸引子使用MATLAB
clear all; clc; clf;
dt = .01;
n = 100; %Number of Drawings
t = 0:dt:n; %Time Scale
%INITIAL CONDITIONS
x = 1;
y = 1;
z = 1;
xyz0 = [x y z];
%SOLVE ODE
[t,xyz] = ode45(@rhs, t, xyz0);
x = xyz(:,1);
y = xyz(:,2);
z = xyz(:,3);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%% PLOTTING %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%plot3(x,y,z);
rotate3d on;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%% RHS FOR ODE45 %%%%%%%%%%%%%%%%%%%%%%%%
function xyzdot = rhs(t,xyz)
sigma = 10;
b = 8/3;
r = 100;
x = xyz(1);
y = xyz(2);
z = xyz(3);
dxdt = sigma*(y - x);
dydt = r*x - y - x*z;
dzdt = x*y - b*z;
xyzdot = [dxdt; dydt; dzdt];
end
我想這早些時候:
[X,Y] = meshgrid(x,y);
surf(X, Y, z);
但沒有的工作。錯誤說z必須是矩陣,我有點失落。任何幫助表示讚賞!謝謝