Error using plot Conversion to double from sym is not possible.
이전 댓글 표시
plot([0,2],[0,0],'k');
plot([0,0],[0,2],'k');
sol=dsolve('D3y-3*D2y+y=-3*x','y(0)=0','Dy(0)=3','D2y(0)=0','x');
xx = 0:0.1:2;
yy = subs(sol,'t',xx);
plot(xx,yy);
axis([-1,2.5,-1,2.5]);
답변 (4개)
Walter Roberson
2013년 2월 17일
편집: Walter Roberson
2013년 2월 17일
plot(xx, double(yy))
If that gets you the same error then examine sol and you will likely find that it has at least one free variable other than t.
댓글 수: 2
Gandi Pirkov
2013년 2월 17일
Walter Roberson
2013년 2월 19일
That indicates that your dsolve() result has at least one free variable beyond the 't' that you substituted in. "A"'s response pointing out that you would likely not have a "t" looks reasonable to me.
Dear Gandi Pirkov,
the variable of your equation is x, why you are addressing t and xx?! I have modefied it, the following code works without error
plot([0,2],[0,0],'k'); plot([0,0],[0,2],'k');
sol=dsolve('D3y-3*D2y+y=-3*x','y(0)=0','Dy(0)=3','D2y(0)=0','x'); x = 0:0.1:2;
plot(x,subs(sol));
axis([-1,2.5,-1,2.5]);
Good Luck
omayma mansouri
2015년 8월 3일
0 개 추천
Error using plot Conversion to double from sym is not possible. need help to solve this problem, thank you
댓글 수: 1
omayma mansouri
2015년 8월 3일
편집: omayma mansouri
2015년 8월 3일
Error using plot Conversion to double from sym is not possible need help to solve this problem, thank you my code matlab
Steven Lord
2015년 8월 3일
Change your SUBS call to substitute xx in for x not t, since you told DSOLVE that your independent variable is x by specifying it as the final input argument.
yy = subs(sol, 'x', xx);
카테고리
도움말 센터 및 File Exchange에서 Common Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!