MATLAB Answers

How to plot complicated exponential function 4.82 (1 + 0.35 e^ −4.07t ) / (1 − 0.35 e^−4.07t) on matlab

4 views (last 30 days)
Jonathan Mui
Jonathan Mui on 23 Oct 2020
Answered: Mathieu NOE on 23 Oct 2020
I need help plotting the function above in MATLAB. Currently an empty graph shows up when I tried to set the x and y values and plot the graph and I can't figure out what's wrong with my code:
x = 0 : 0.01 : 10.00;
y = ((4.8184) * (1 + 0.3497.*exp(-4.0719.*x))) / (1 - 0.3497.*exp(-4.0719.*x));
plot(x, y)

  0 Comments

Sign in to comment.

Accepted Answer

Mathieu NOE
Mathieu NOE on 23 Oct 2020
your y output is a scalar because your division is / and not ./
so this works :
x = 0 : 0.01 : 10.00;
y = ((4.8184) * (1 + 0.3497.*exp(-4.0719.*x))) ./ (1 - 0.3497.*exp(-4.0719.*x));
plot(x, y)

  0 Comments

Sign in to comment.

More Answers (1)

Vladimir Sovkov
Vladimir Sovkov on 23 Oct 2020
Use the element-wise division when computing y:
y = ((4.8184) * (1 + 0.3497.*exp(-4.0719.*x))) ./ (1 - 0.3497.*exp(-4.0719.*x));

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!