Ploting graph on matlab

Hi I just want to plot this equation on matlab and plot the graph for finding the type of its graph too.
here is my code but it didn't work well:
clc, close all
t = 0:1:100000;
ic = -30000*t.*exp(-5000*t) + 6*exp(-5000*t);
figure(1);clf;
plot(t, ic);
xlabel('\bf\it Time ', 'fontsize', (25)),
ylabel('\bf\it Amplitude', 'fontsize', (25)),

 Risposta accettata

The function declines very rapidly, so use a different value for ‘t’
% t = 0:1:100000;
t = linspace(0, 2E-3, 500);
ic = -30000*t.*exp(-5000*t) + 6*exp(-5000*t);
figure(1)%;clf;
plot(t, ic);
xlabel('\bf\it Time ', 'fontsize', (25)),
ylabel('\bf\it Amplitude', 'fontsize', (25)),
Also, the clf call immediately clears ‘figure(1)’ after creating it. The plot call regenerates it so nothing is actually lost, however it is inefficient to create it, clear it, then create it again.

4 Commenti

cikalekli
cikalekli il 18 Mag 2021
Oh now I get it. I do not know how to thank you a lot...
Let me ask you two questions please;
1- I just tried to set this code with 1 millisecond. Is t = 0:1:100000 showing the time set 1 millisecond?
Or how can I change it for 1 millisecond. I'm really wondering it.
2- Do we call this type of graph as "Underdamped"?
Thank you very much again.
Also, sorry how could we find out this -> t = linspace(0, 2E-3, 500);
Could you explain for me in your free time please? Because I want to really deeply understand also this part too.
Sorry again bothering you with my questions :(
Star Strider
Star Strider il 18 Mag 2021
As always, my pleasure!
1- I just tried to set this code with 1 millisecond. Is t = 0:1:100000 showing the time set 1 millisecond?
I do not understand what this means. The curve is essentially 0 after 2 ms, assuming that the tine constants of the exponentials are in units of 1/sec.
2- Do we call this type of graph as "Underdamped"?
I would.
Also, sorry how could we find out this -> t = linspace(0, 2E-3, 500);
No worries! I looked at the time constants of the exponentials and then experimented to get a decent-looking plot.
.
cikalekli
cikalekli il 18 Mag 2021
Modificato: cikalekli il 18 Mag 2021
You clearly demonstrated and answered perfectly all of my questions and I purely understood what you meant.
Yeah, now I've just seen that the curve has been set with 0 to 2ms I got it when you wrote this.
Please take care of yourself and I will continue working on my matlab skills after that :)
Thank you ^_^
Star Strider
Star Strider il 18 Mag 2021
Thank you!
As always, my pleasure! Please take good care of yourself as well!
You appear to be learning MATLAB quickly!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Creating, Deleting, and Querying Graphics Objects in Centro assistenza e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by