Why the plot window is empty ?

Hi Guys I wrote a code and I want to plot it as shown, but it gives me an empty plot. No curves just the x and y-axis .Any answers?

4 commentaires

KVM
KVM le 29 Nov 2017
t = linspace(0,100,1) only gives 1 point. Take a closer look to your "t". You probably only have 1 value. So you won't have a plot with only 1 point...Why not using something like: t= [1:1:100]
Rik
Rik le 29 Nov 2017
Why suggest that syntax if you can suggest t=1:100? Shorter and more readable.
Using colon notation is best when you know a start and a step, using linspace is best when the step doesn't matter, but the number of steps do.
Connor Ferster
Connor Ferster le 30 Nov 2017
The comments above, plus, your V is currently equal to zero so you wouldn't even see a point on the plot.
KSSV
KSSV le 30 Nov 2017
Don't attach screen shot..attach your code.....

Connectez-vous pour commenter.

Réponses (1)

Rana 55
Rana 55 le 1 Déc 2017
Modifié(e) : Jan le 1 Déc 2017

0 votes

Ok I do what you say guys but it should not graph like that. The graph should rise not fall I do not know what is wrong
>> L = 10e-3;
>> C =10e-6;
>> R =1000;
>> w = 1/sqrt(L.*C);
>> alpha = R/(2.*L);
>> D1=(- alpha + sqrt(alpha.^2 - w.^2))/2;
>> D2=(- alpha - sqrt(alpha.^2 - w.^2))/2;
>> t = 0 : 0.005 : 0.35;
>> V= exp(D1.*t)+exp(D2.*t);
>> plot(t,V)
[EDITED, Jan, Code formatted]

1 commentaire

Jan
Jan le 1 Déc 2017
"It should not graph like this"? Matlab does exactly, what you instruct it to do. If you expect something else, either the code or the expectations are wrong.

Connectez-vous pour commenter.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange

Question posée :

le 29 Nov 2017

Commenté :

Jan
le 1 Déc 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by