plot doesn`t work (probably unrelated to the code )
Show older comments
%start
clear all
syms y(t) a Vp
Vp = 1;
Dy=diff(y(t));
Dt=diff(t);
t=0:0.0001:0.4999;
pulseRC1=dsolve(a*(Dy/Dt)+y==Vp,y(0)==0);
pulseRC1=eval(pulseRC1);
plot(t,pulseRC1);
hold on
t= 0.5000:0.0001:1;
pulseRC2=dsolve((Dy/Dt)*0.1+y==0,y(0.5)==Vp);
pulseRC2=eval(pulseRC2);
plot(t,pulseRC2);
hold off
pulseRc=[pulseRC1,pulseRC2];
xlabel('t')
ylabel('pulseRC')
}
%end
These are the matlab codes I have been working on.
I typed this set of codes by hand and when I run it, matlab only returns a matrix of numeric values in command window. On the other hand, the other set of code which is exactly the same but typed on a different computer runs perfectly well on my computer.//
So far I have tried to reinstall the matlab and updated to the latest version. The problem stay the same.//
What is strange to me is that the fact if I copy the working code to the current script, instead of returning a plot graph, it only return a set of numeric answers.
2 Comments
Rik
on 16 Aug 2018
What does the following line of code return as output?
which plot -all
Ziming Huang
on 20 Aug 2018
Accepted Answer
More Answers (1)
your t value is in double format and pulseRC1 is in sym format. keep both the formats as same. Then plot the values. In your file pulseRC1 is showing empty matrix.
1 Comment
Ziming Huang
on 20 Aug 2018
Categories
Find more on Graph and Network Algorithms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!