Help with basic matlab
显示 更早的评论
Thanks for reading my question
When I use dsolve in an ivp I get this ans:
dsolve('Dy = -yt + sin(3t) - cos(t.01) + 3sin(7*t)', 'y(0) = 0')
ans =
exp(-t^2/2)*int(exp(x2/2)(sin(3x) - cos(x/100) + 3sin(7x)), x = 0..t, IgnoreAnalyticConstraints)/exp(t2/2)
I would like to know how can I evaluate it in the interval t=0:h:20, dom =[0 20] if h=(5,5/2,5/4,....), if i just simply eval, matlab shows an error even if i ignore the analytic constraints.
Error using sym/eval (line 11)
Error: Unexpected MATLAB expression.
I think it is because eval does't work with integrals.
1 个评论
Walter Roberson
2013-5-14
Your notation is a bit ambiguous. Are you attempting to do
dsolve('diff(y(t), t) = -y(t)+sin(3*t)-cos((1/100)*t)+3*sin(7*t)', 'y(0) = 0')
If you are then,
y(t) = -(3/10)*cos(3*t) + (1/10)*sin(3*t) - (10000/10001)*cos((1/100)*t) - (100/10001)*sin((1/100)*t) - (21/50)*cos(7*t) + (3/50)*sin(7*t) + (430018/250025)*exp(-t)
I do not find any useful simplifications of that.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!