问题描述:利用for循环,选择10个噪声强度,运行出来的时间t和10组x1,x2保存在数组y,用save保存数组时,对于复数能保存实部
要求:怎样才能既保存复数的实部又保存虚部
%%噪声为白色噪声
%%初始值1:At=9.0455,Bt=0.40576
clc
clear;
t0=0;tf=100000;
x0=[9.0455,0.40576];
n=200000;
h=tf/n;
t=linspace(t0,tf,n+1)';
y=zeros(n+1,21);
y(:,1)=t;
for i=1:+1:10
D_ext=0.1+i/100;
dw1=sqrt(D_ext)*randn(1,n+1)/sqrt(h);
dw2=sqrt(D_ext)*randn(1,n+1)/sqrt(h);
m=2;
x1=zeros(n+1,m);
x1(1,:)=x0+h*(LPS_SMultiFate2(t0,x0,dw1(1),dw2(1)))';
for j=2:n+1
k1=h*(LPS_SMultiFate2(t(j-1),x1(j-1,:),dw1(j),dw2(j)))';
x1(j,:)=x1(j-1,:)+k1;
end
y(:,2*i:2*i+1)=x1;
subplot(5,2,i)
plot(y(:,1),y(:,2*i),'r');
hold on
titlename=strcat('D_{ext}=',num2str(D_ext));
title(titlename);
xlabel('时间');
ylabel('浓度');
end
%save('C:\xppall\ode\by myself ode\MultiFate\MultiFate-2\LPS_MultiFate2\data\DR_Dext(0.1-0.2).txt','y','-ascii');