Skip to main content
Best answer by Werner_E

Your function Vout is not using the "time" argument at all!

And your plot is not using R3 at the abscissa, so you get all constant values.

 

How should Vout change dependent on the time?

Maybe you have to define R3 as a function of t ....

 

In this example I assume a linear relationship between time and resistance R3

Werner_E_1-1709805241101.png

 

And here an exponential relationship between time and resistance R3

Werner_E_2-1709805587812.png

 

 

 

1 reply

Werner_E25-Diamond IAnswer
25-Diamond I
March 7, 2024

Your function Vout is not using the "time" argument at all!

And your plot is not using R3 at the abscissa, so you get all constant values.

 

How should Vout change dependent on the time?

Maybe you have to define R3 as a function of t ....

 

In this example I assume a linear relationship between time and resistance R3

Werner_E_1-1709805241101.png

 

And here an exponential relationship between time and resistance R3

Werner_E_2-1709805587812.png

 

 

 

Cornel19-TanzaniteAuthor
19-Tanzanite
March 7, 2024

All variables are depending on time...
Your first answer is good, I mean that with linear relationship between time and resistance R3.

I was thinking at 2 for loops, something like that:

Cornel_1-1709806112123.png
In this way I think if I will have 3, 4, or more variables that I need to iterate then maybe will be more easily to add another for loop, but I do not know exactly at this moment if this way is possible and a good way

Cornel_2-1709806124793.png

 

25-Diamond I
March 7, 2024

Unless you want the two variables to 'iterate' independently from each other (which would result in a 3D surface plot)  you have to specify in which way one variable should relate to the other and this is done by defining functions.

A (IMHO bad) alternative would be to provide t and R3 as equal length (!!) vectors

Werner_E_0-1709807652795.png

 

Ranges are to be used in three occasions only:

1) To index the elements of vectors and matrices

2) as the independent variable in a 2D XY-plot (and there is only ONE independent variable in a 2D XY-plot)

3) in a program when you use a for-loop