exponential decay function y = exp*(-Tau.time)
69 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Another exponential decay function I am having problem with: Need to write script to plot the following equation
y = exp ^ -(timeconstant*time)
prompt the user for beginning and ending values of time vector.
prompt the user for two values of timeconstant
Now, calculate two different y vectors
Here is what I did:
timeconst1 = input('Please enter the first value of time constant: ');
timeconst2 = input('please enter the second value of time constant: ');
initial = input('Please enter the beginning value of time: ');
final = input('Please enter the ending value of time: ');
vec = initial:final;
yinitial = exp(-timeconst1*vec)
plot(initial,yinitial,'r*')
hold on
yfinal = exp(-timeconst2*vec)
plot(final,yfinal,'c*')
0 Commenti
Risposta accettata
Mischa Kim
il 30 Gen 2015
Hi Nabin, to help with readability I have slightly re-formatted the code and re-named some variables:
tau1 = 1;
tau2 = 2;
ti = 1;
tf = 10;
t = linspace(ti,tf,20);
yinitial = exp(-tau1*t);
yfinal = exp(-tau2*t);
plot(t,yinitial,'r*')
hold on
plot(t,yfinal,'c*')
hold off
0 Commenti
Più risposte (1)
ZUBAIR WAR
il 13 Ago 2022
tau1 = 1;
tau2 = 2;
ti = 1;
tf = 10;
t = linspace(ti,tf,20);
yinitial = exp(-tau1*t);
yfinal = exp(-tau2*t);
plot(t,yinitial,'r*')
hold on
plot(t,yfinal,'c*')
hold off
0 Commenti
Vedere anche
Categorie
Scopri di più su Get Started with MATLAB in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!