How to get a plot?
1 次查看(过去 30 天)
显示 更早的评论
v=dsolve('D2v=-2*Dv-3*v+4*10*sin(5*pi*t)','v(0)=0','Dv(0)=0','t')
how can i get plot(t,v) ???
0 个评论
采纳的回答
Ameer Hamza
2020-10-24
编辑:Ameer Hamza
2020-10-24
You can use fplot()
syms t v
v = dsolve('D2v=-2*Dv-3*v+4*10*sin(5*pi*t)','v(0)=0','Dv(0)=0','t')
fplot(v)
Also, defining ODEs as string is not recommended. You can define it using symbolic variables as follow
syms v(t)
dv = diff(v, 1);
d2v = diff(v, 2);
eq = d2v == -2*dv-3*v+4*10*sin(5*pi*t);
conds = [v(0) == 0; dv(0)==0];
v = dsolve(eq, conds, t)
fplot(v)
4 个评论
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!