# Answer to Question #6281 in MatLAB | Mathematica | MathCAD | Maple for Mark

Question #6281

i(t)=(V/R) * (1-e^-(R/L)(t))

(a) Define an anonymous function answerE that returns i(t) given input t.

(b) The final value for the current is 2 amps. Find a time tm when the

current is at least 99% of the nal value but strictly less than 2. Store

this value in the variable answerF.

(c) Create a vector in answerG using linspace with ten evenly spaced

elements where 0 as the first element and tm as the last element.

(d) Create a vector in answerH which contains the current at each time in

vector answerG.

(a) Define an anonymous function answerE that returns i(t) given input t.

(b) The final value for the current is 2 amps. Find a time tm when the

current is at least 99% of the nal value but strictly less than 2. Store

this value in the variable answerF.

(c) Create a vector in answerG using linspace with ten evenly spaced

elements where 0 as the first element and tm as the last element.

(d) Create a vector in answerH which contains the current at each time in

vector answerG.

Expert's answer

a) To define an anonymous function answerE that returns i(t) given input t run the command:

answerE=@(t)(V/R[/url])*( 1-exp(-(R*t/L)) );

b) We have that the final value for the current is 2 amps.

This means that V/R = 2.

In order to find tm we need to know the value of R/L.

In other words we should give some values for V, R, L.

So set some values and then redefine the function:

V=2;

R=1;

L=0.5;

answerE=@(t)(V/R[/url])*( 1-exp(-(R*t/L)) );

To find a time tm when the current is at least 99% of the final value but strictly less than 2,

and store this value in the variable answerF, run

answerF = fsolve(@(t)answerE(t)-0.99*V/R,1)

we will get the result:

>> answerF = 2.3026

(c) To create a vector in answerG using linspace with ten evenly spaced elements where 0 as the first

element and tm as

the last element run

answerG=linspace(0,answerF,10)

which will give the output

>> answerG =

>> 0.00000 0.25584 0.51169 0.76753 1.02337 1.27921 1.53506 1.79090 2.04674 2.30259

(d) To create a vector in answerH which contains the current at each time in vector answerG

run

answerH=answerE(answerG)

which will give the output

>> answerH =

>> 0.00000 0.80103 1.28124 1.56911 1.74169 1.84515 1.90717 1.94435 1.96664 1.98000

answerE=@(t)(V/R[/url])*( 1-exp(-(R*t/L)) );

b) We have that the final value for the current is 2 amps.

This means that V/R = 2.

In order to find tm we need to know the value of R/L.

In other words we should give some values for V, R, L.

So set some values and then redefine the function:

V=2;

R=1;

L=0.5;

answerE=@(t)(V/R[/url])*( 1-exp(-(R*t/L)) );

To find a time tm when the current is at least 99% of the final value but strictly less than 2,

and store this value in the variable answerF, run

answerF = fsolve(@(t)answerE(t)-0.99*V/R,1)

we will get the result:

>> answerF = 2.3026

(c) To create a vector in answerG using linspace with ten evenly spaced elements where 0 as the first

element and tm as

the last element run

answerG=linspace(0,answerF,10)

which will give the output

>> answerG =

>> 0.00000 0.25584 0.51169 0.76753 1.02337 1.27921 1.53506 1.79090 2.04674 2.30259

(d) To create a vector in answerH which contains the current at each time in vector answerG

run

answerH=answerE(answerG)

which will give the output

>> answerH =

>> 0.00000 0.80103 1.28124 1.56911 1.74169 1.84515 1.90717 1.94435 1.96664 1.98000

## Comments

## Leave a comment