微分方程系统的集成MATLAB

微分方程系统的集成MATLAB

本文介绍了微分方程系统的集成MATLAB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Matlab的新用户,我必须探索它才能对微分方程组进行数值积分.现在,我正在尝试求解一个简单的方程式,但这给了我一个"lambertw"输出.

I am a fairly new Matlab user which I had to explore to numerically integrate a system of differential equations. Now I am trying to resolve a simple equation but which gives me a "lambertw" output.

(s - 1) * exp(-s) = k

因此,对于给定的k,对于k < exp(2),我应该获得大约两个不同的"s"值.这是我用于此任务的一些代码(使用符号工具箱):

Therefore, for a given k, with k < exp(2) I should get approximately two different values of "s". Here is the bit of code I use for this task (using symbolic toolbox):

%%Hopf bifurcation calculations
syms s
solve((s-1) * exp(-s) == k, s)
%uhopf = s*k

输出:

1 - lambertw(0, -(3*exp(1))/25)

看了一些我试图获得一个没有成功的显式解决方案:

After looking at some examples I tried to get an explicit solution with no success:

syms x
x=solve('(s-1)*exp(-s) == k')

最后,我的问题是如何将第一位给出的结果更改为一个简单的数值,即给定k会给我s1和s2.任何提示或帮助将不胜感激!我还在看其他一些例子.

Finally, my question is how do I change the result given in the first place into a simple numerical value that fir a given k would give me s1 and s2. Any hint or help would be much appreciated ! I am still looking at some other examples.

推荐答案

如果我正确理解了您的问题,则可以使用eval()函数对字符串求值以检索一个简单的数值示例.

If I understand your question correctly, you can use the eval() function to evaluate the string to retrieve a simple numerical example.

例如

char s;
char k;
A=solve('(s-1) * exp(-s) = k', 'k=exp(1)');

sol_s=A.s(1);
sol_k=A.k(1);

ans=eval(sol_s)

这篇关于微分方程系统的集成MATLAB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 19:19