Previous in Forum: Electrical Power   Next in Forum: MSP430 To Do The Night Light
Close
Close
Close
12 comments
Rate Comments: Nested
Commentator

Join Date: Jan 2017
Posts: 57
Good Answers: 1

Embarrassing Question

01/16/2017 2:24 PM

Hey all

Im hoping someone can explain this

This is fairly embarrassing i don't remember why this is not working out

Simple RC circuit

We know the transfer function to be the following

Vout/Vin = (1)/(S*R*C+1)

Or if you want to rearrange it in the proper form you get.

(1/RC)/(S+1/RC)

Anyways. If you give this thing a step input you get a curve that looks like the following using matlab

Again no surprise. As the cap begins to block the voltage builds up as the current flow tends towards zero

No surprise here

So anyway here is what i can't remember.

Just for the hell of it, i was trying to take the laplace and do the inverse and plot it in math against time t without using the step command. Obviously i should get the same results

The inverse is easily found using the table of course

Now lets just take something simple

Say R = 1k and C = 1u

And plot the thing

You get something very different then what the step response should be

You clearly get a decay which is obviously not the case.

So what am i missing? Why when put back into time does the function not behave properly? or more likely, what am i doing wrong here?

This is what the plot looks like of the inverse in T

What am i doing wrong?

Thanks in advance for helping me fix my lost memory

Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

Good Answers:

These comments received enough positive votes to make them "good answers".
Guru
Canada - Member - If there is a way to screw someting up, there is someone to do so! Safety - Hazmat - New Member

Join Date: Mar 2007
Location: Iqaluit, NU. Canada
Posts: 1854
Good Answers: 140
#1

Re: Embarrassing question

01/16/2017 2:53 PM

Well... just off of the top of my head, if you expected the traces to be exact inverses of each other, you need to fix the scaling. Different from one plot to the next.

__________________
Joe Contractor to Electrical Inspector, "What do you mean you are going to make me follow the code?".
Register to Reply
Commentator

Join Date: Jan 2017
Posts: 57
Good Answers: 1
#2
In reply to #1

Re: Embarrassing question

01/16/2017 2:58 PM

No no they should not be the inverse of each other they should be the EXACT same curve

They are the same function

The scaling is off simply because those are not the exact plots i just posted those picture so people could see what the general shape is

The top one is correct like we would expect.

The bottom one shows a decay for some reason and that is incorrect and i don't know why

Given the fact that the laplace inverse is correct

Register to Reply
Commentator

Join Date: Jan 2017
Posts: 57
Good Answers: 1
#3

Re: Embarrassing question

01/16/2017 3:44 PM

Anyone else?

I mean this is just an RC circuit lol i know there are some smart folks on here

Register to Reply
Guru
New Zealand - Member - Kiwi Popular Science - Weaponology - New Member Engineering Fields - Power Engineering - New Member Engineering Fields - Electrical Engineering - New Member

Join Date: Sep 2006
Location: Auckland, New Zealand
Posts: 8777
Good Answers: 376
#4

Re: Embarrassing question

01/16/2017 3:58 PM

Obviously i should get the same results

Should you, or should you get an RC time constant capacitor discharge curve instead?

RC time constant discharge curve

It's been a while since I had to do the math but the charge and discharge curves are different. Isn't the inverse of a RC time constant charge curve the discharge curve?

__________________
jack of all trades
Register to Reply
Commentator

Join Date: Jan 2017
Posts: 57
Good Answers: 1
#5
In reply to #4

Re: Embarrassing question

01/16/2017 4:03 PM

yes of course they are different

But this has nothing to do with What I'm asking

My function is the step response of the circuit not the discharge

The only difference is one is laplace and on is in time t

These two functions are suppose to be identical

One is in s the other is in t

They should match up exact

The step response in t is just 1

So Vout_in_t = 1 * (Inverse Laplace of the function)

They should be identical

Register to Reply
2
Guru

Join Date: Dec 2010
Posts: 1686
Good Answers: 116
#6

Re: Embarrassing question

01/16/2017 4:20 PM

The inverse you give is not the inverse of the transfer function * 1/s, where 1/s = the step function.

What you need is the inverse of [α /(s + α)]*1/s = α /[s(s + α)]

where α = 1/CR

According to my tables the laplace transform of 1 - exp(-αt) is α /[s(s + α)]

Register to Reply Good Answer (Score 2)
3
Commentator

Join Date: Jan 2017
Posts: 57
Good Answers: 1
#7
In reply to #6

Re: Embarrassing question

01/16/2017 4:29 PM

Im a moron

Your answer is not the reason mine is wrong but your answer reminded me of what i did wrong

The step function in matlab automatically multiples it by 1/s

When i do it in T i must multiply it manually.

For my time function i left out the 1/s

THANK YOU!

Register to Reply Good Answer (Score 3)
2
Guru

Join Date: Dec 2016
Posts: 2914
Good Answers: 115
#8
In reply to #7

Re: Embarrassing question

01/16/2017 5:02 PM

The dead giveaway is that the second plot starts out with charge already stored in the cap. Where did that charge come from? Certainly not the from the step function, so somewhere the step function must've gone AWOL, no?

I helps sometimes to step away from the mathematical representation and think about how the physical device actually works, apart from its abstract representation. When all else fails, derive it from first principles. That way you don't have remember anything.

Register to Reply Good Answer (Score 2)
Commentator

Join Date: Jan 2017
Posts: 57
Good Answers: 1
#10
In reply to #8

Re: Embarrassing question

01/17/2017 11:44 AM

Yes I knew it was wrong the second I saw it from intuition

Problem was my code per usual....

Thanks to everyone for jogging my memory

doesn't work so well when you forget to give it a 1/s input

Thanks again folks

Register to Reply
Guru
United Kingdom - Member - Indeterminate Engineering Fields - Control Engineering - New Member

Join Date: Jan 2007
Location: In the bothy, 7 chains down the line from Dodman's Lane level crossing, in the nation formerly known as Great Britain. Kettle's on.
Posts: 32175
Good Answers: 839
#9

Re: Embarrassing question

01/17/2017 4:13 AM

All one has to remember is that for a first-order system, the response is within 1% of the new setpoint after 5 time constants.

__________________
"Did you get my e-mail?" - "The biggest problem in communication is the illusion that it has taken place" - George Bernard Shaw, 1856
Register to Reply
Guru
Safety - Hazmat - New Member United States - US - Statue of Liberty - New Member Engineering Fields - Chemical Engineering - Old Hand

Join Date: Mar 2011
Location: Lubbock, Texas
Posts: 14331
Good Answers: 162
#11

Re: Embarrassing Question

01/17/2017 1:57 PM

You have to evaluate the functions over the same time limits?

you forgot a constant somewhere that transforms as 1-eX

__________________
If it ain't broke, don't fix it. Just build a better one.
Register to Reply
Guru

Join Date: Oct 2012
Location: 100 miles North from the World Center
Posts: 879
Good Answers: 42
#12

Re: Embarrassing Question

01/19/2017 4:37 AM

First of all-that has to remain between us- I hate Laplace- and the matlab also- since I am an old Power Electrical Engineer and the complex calculation and Microsoft Excel workbook is my usual way to solve a problem. Of course, nobody cares what a hate or like.

Second, since we have a lot of way to connect R and C let's take this one.

Now in summary, let's remember what I learned many years ago:

1) By definition the transformations are [ >>="it corresponds to"]:

d(f(t))/dt>>s*f(s) integral(f(t))>>f(s)/s k>>k/s f(t)>>f(s)

vcap=qcap/C vcap=integral(i(t))/C

2) The voltage drop on the above circuit is then:

vin=R*i(t)+integral(i)/C

By derivation :

dvin/dt=R*di/dt+i/C

Translating:

s*Vin=(s*R+1/C)*i(s) then:

i(s)=s*vin(s)/(s*R+1/C)

vout(s)=i(s)/C/s

vout(s)=vin(s)/(s*R+1/C)/C

Vin=constant[k] then vin(s)=Vin/s and:

vout(s)=Vin/(s^2*R*C+s) or:

vout(s)=Vin/(R*C)/(s^2+s/(R*C))

Let's put a=1/(R*C) then from table:

1/s/(s+a)>>(1-exp(-a*t))/a then finally:

vout(t)=Vin*(1-exp(-t/(R*C)) Q.E.D.

__________________
Julius
Register to Reply
Register to Reply 12 comments

Good Answers:

These comments received enough positive votes to make them "good answers".
Copy to Clipboard

Users who posted comments:

67model (1); 7anoter4 (1); Andrew Westman (1); jack of all trades (1); James Stewart (1); North of 60 (1); PWSlack (1); Rscott9399 (5)

Previous in Forum: Electrical Power   Next in Forum: MSP430 To Do The Night Light

Advertisement