搜索内容 搜索用户

# [已解决] 数据必须为可转换为双精度值的数值、日期时间、持续时间或数组。

393215071 发表于 2022-5-12 01:34:15
 sol=dsolve('DP1=lambda1-(lambda1+Mu1)*P1-lambda1*P2','DP2=lambda2-(lambda2+Mu2)*P2-lambda2*P1','P1(0)=0','P2(0)=0','x'); P1=simplify(sol.P1); P2=simplify(sol.P2); P0=1-P1-P2; lambda1=1; lambda2=1; Mu1=2; Mu2=4; x=0:0.01:10; P0=1-P1-P2; plot（x,P0) plot这一步的时候会报错，P0类型为1*1sym

20141303 发表于 2022-5-12 08:35:53
 仅供参考 sol=dsolve('DP1=lambda1-(lambda1+Mu1)*P1-lambda1*P2','DP2=lambda2-(lambda2+Mu2)*P2-lambda2*P1','P1(0)=0','P2(0)=0','x'); P1=simplify(sol.P1); P2=simplify(sol.P2); P0=1-P1-P2; % lambda1=1; % lambda2=1; % Mu1=2; % Mu2=4; P1 = subs(P0,{'lambda1','lambda2','Mu1','Mu2'},{1,1,2,4}); x1=0:0.1:10; for i=1:length(x1)     P2(i)=double(subs(P1,'x',x1(i))); end plot(x1,P2)复制代码

2 条回复

## 倒序浏览

20141303 发表于 2022-5-12 08:35:53
 仅供参考 sol=dsolve('DP1=lambda1-(lambda1+Mu1)*P1-lambda1*P2','DP2=lambda2-(lambda2+Mu2)*P2-lambda2*P1','P1(0)=0','P2(0)=0','x'); P1=simplify(sol.P1); P2=simplify(sol.P2); P0=1-P1-P2; % lambda1=1; % lambda2=1; % Mu1=2; % Mu2=4; P1 = subs(P0,{'lambda1','lambda2','Mu1','Mu2'},{1,1,2,4}); x1=0:0.1:10; for i=1:length(x1)     P2(i)=double(subs(P1,'x',x1(i))); end plot(x1,P2)复制代码

393215071 发表于 2022-5-12 14:35:14
 20141303 发表于 2022-5-12 08:35 仅供参考 感谢回答
 您需要登录后才可以回帖 登录 | 注册 本版积分规则 回帖后跳转到最后一页