How do i get an equation in an exponent

1 view (last 30 days)
Brendan Proaps
Brendan Proaps on 16 Sep 2020
Commented: Walter Roberson on 16 Sep 2020
I have this equation
I = 25e(-R/L)*t
I have inputs for R,L, and t but it gives me an error just the same.
R= [1 2 3 5]
L = input('blah blah','s')
t = linspace(0,2,20)
I=25exp((-R/L*t))
floating point error
OR
Equ_1 = (-R/L)*t
I=25exp(Equ_1)
invalid use of operator.
  3 Comments
Brendan Proaps
Brendan Proaps on 16 Sep 2020
What does that mean, I barely know anything about programming.
Walter Roberson
Walter Roberson on 16 Sep 2020
Implied multiplication is when you place two items (numbers or expressions) beside each other without any operator between them, and you expect that they will be multiplied. For example, would almost certainly be intended to mean 25 multiplied by R, , but MATLAB will never interpret 25R or 25 R as multiplication. You need to put in explicit multiplication symbols, 25.*R

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 16 Sep 2020
R= [1 2 3 5];
L = input('blah blah '); %NOT 's'
t = linspace(0,2,20);
[Rg, Lg, tG] = ndgrid(R, L, t);
I = 25 .* exp((-R./L.*t));
The result will be 4 by numel(L) by 20

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!