Plotting trigonometric, negative exponential functions
Show older comments
My question could be more related to math than Matlab, but since I want to plot them in matlab, I am asking it here.
I attached the functions that I'm trying to plot.
My Questions are:
1) why my trigonometric function is different from the attached? mine doesn't look like sine and cosine functions at all.
2) how to plot negative exponential function?
Here is my code:
t=1:1:100;
to=1;
th=t(end)-t(1);
b_l=0.2; a_l=1-b_l; % linear coeff
a_t=0.2; b_t=acos(2/a_t)/pi(); % trigonometric coeff
a_e = 0.2; b_e=-log(1/a_e); %exponential coeff
y1 = a_e * exp(-b_e*(t-to)/(th-to)); % exponential
y2 = a_l*((t-to)/(th-to)) + b_l; % linear
y3 = (a_t/2)*( 1 + cos( (pi().*(t-to)*b_t)/(th-to) ) ); % Trigonometric
figure(1);
plot(t,y1,'-k','LineWidth',3); hold on;
plot(t,y2,'-r','LineWidth',3); hold on;
plot(t,y3,'-m','LineWidth',3); hold on;
legend('Exponential','Linear','Trigonometric','FontSize',14,'FontName','Time New Roman','Location','NorthWest');
3 Comments
madhan ravi
on 20 Jun 2020
Post the actual exponential equation in mathematical form.
John D'Errico
on 20 Jun 2020
Edited: John D'Errico
on 20 Jun 2020
@Mos_bad
Please don't answer your own question just to make a comment. Use a comment instead.
"Here are the math expressions that I found:
f_trigonometric (t) = (a/2) [1+cos( (πb (t-to))/(th- to )) ]
f_exponential (t)=a e^[(-b(t - to))/(th- to )]
and a and b are constants. the to and th in expression are equivalent to t0e and t0e+Tlc in attached figure, respectively.
And for negative exponential function, I don't have any math expression. I just found the attached plot in litrature.
0 Comments"
Mos_bad
on 22 Jun 2020
Answers (0)
Categories
Find more on Mathematics 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!