How can we model this equation in simulink dx/dy + x + y = 1 where x is the input and y is the output.

65 views (last 30 days)
Basavalingappa Mudhol on 18 Dec 2016
Commented: John BG on 19 Dec 2016
how to model this equation in simulink dx/dy + x + y = 1

John BG on 18 Dec 2016
BACK TO BASICS
.
here I am using the grey background to highlight functions, not MATLAB code.
.
Misha and Basa,
the usage of 1/u in Misha's solution, in this context is erroneous, let me show you why:
1.- one of the possible solutions to dx/dy+y+x-1=0 is
x=1-exp(-y)
2.- inverting x(y)
x=1-exp(-y)
ln(1-x)=-y
so we have
y=-ln(1-x), or ln(|1-x|)
the 1st key point you need to understand is that d(y)/dx is not a division operator, it's a convention to express derivative, which is an operator that generally speaking does not comply with
if u=f(v) d(f(v),v)=k
let be v=g(u)
it's not generally correct assume d(g(u),u)=k/f(v)
2.- according to Misha,
dy/dx=1/(1-x-y)
but
dy/dx=d(-ln(1-x))/dx=1/(1-x)
yet
1/(1-x-y)=1/(1-x+ln(1-x)) or 1/(1-ln(|1-x|))
which obviously are not the same
Misha the 2nd reason why you shouldn't be using 1/u is that you may be losing poles while constraining the function domain to that of u=f(v), not the variable intended to be the domain.
For these reasons I consider my answer deserves to be the accepted answer.
Additionally, Basa, I gave the Simulink diagram first, Misha had just given some general indications, Misha saw my diagram, he builds an erroneous Simulink equation, and you Basa mark as accepted an erroneous Simulink circuit for the above reasons.
Please reconsider marking my answer as accepted.
John BG
Roger Stafford on 19 Dec 2016
If it is of interest to you, there is a general solution to this differential equation which expresses x as a function of y:
x = 2 - y + K*exp(-y)
where K is an arbitrary constant of integration. Expressing y as a function of x would undoubtedly involve the ‘lambertw’ function.
John BG on 19 Dec 2016
You are trying to get off the tangent with a technical term, let's do it:
1.-
x = 2 - y + K*exp(-y)
dx/dy=-1-K*exp(-y)
dx/dy+x+y-1=-1-K*exp(-y) +2 - y + K*exp(-y) -1 +y = 0 correct
now
x-2 = -y+K*exp(-y)
x2=x-2
x2 is a particular case of
x3=p^y-a*y
replace x with y and b with x in Example 1
line starting with 'More generally, ..' p would be number e, 2.7182.. at least you will agree upon this, won't you?
substitution:
-t=y+x3/a
further substitution:
R=-1/a*p^(x/a)
then
t=W(R*ln(p))/ln(p)
because p is e, then
t=W(R)
y=-W(-1/a*exp(-x/a))-x/a
now back on track with your W technicality
dy/dx=-1/a-d(W(-1/a*exp(-x/a)))/dx
dW(z)/dz=W/(z*(1+W)) for z~=-1/e
dy/dx=-1/a-WW(-1/a*exp(-x/a))/(W(-1/a*exp(-x/a))*(1+W(-1/a*exp(-x/a))))
so? where is simple inversion of the operator / ??
Now
2.- go to Basa and tell the kid
and don't tell not to quote from Wikipedia, it's where you got your 'lambertw' from, isn't it?

Mischa Kim on 18 Dec 2016
Edited: Mischa Kim on 18 Dec 2016
Re-write as
dx/dy = 1 - x - y % y is your independent variable, sort of "t"
therefore
dy/dx = 1/(1 - x - y)
Then, from left to right (in your Simulink block diagram) you have
• a summation block, adding up the right hand side, and taking the reciprocal value
• the output goes into an integrator block that outputs y, which is the solution and also feeds back into the summation block

Basavalingappa Mudhol on 18 Dec 2016
i should have y as the output from my system and x being my input i think this is the other case that you have put up in simulink isnt it? Please clarify..
Mischa Kim on 18 Dec 2016
Right you are. I updated the diagram, see above.
John BG on 18 Dec 2016
BACK TO BASICS
.
here I am using the grey background to highlight functions, not MATLAB code.
.
Misha and Basa,
the usage of 1/u in Misha's solution, in this context is erroneous, let me show you why:
1.- one of the possible solutions to dx/dy+y+x-1=0 is
x=1-exp(-y)
2.- inverting x(y)
x=1-exp(-y)
ln(1-x)=-y
so we have
y=-ln(1-x), or ln(|1-x|)
the 1st key point you need to understand is that d(y)/dx is not a division operator, it's a convention to express derivative, which is an operator that generally speaking does not comply with
if u=f(v) d(f(v),v)=k
let be v=g(u)
it's not generally correct assume d(g(u),u)=k/f(v)
2.- according to Misha,
dy/dx=1/(1-x-y)
but
dy/dx=d(-ln(1-x))/dx=1/(1-x)
yet
1/(1-x-y)=1/(1-x+ln(1-x)) or 1/(1-ln(|1-x|))
which obviously are not the same
Misha the 2nd reason why you shouldn't be using 1/u is that you may be losing poles while constraining the function domain to that of u=f(v), not the variable intended to be the domain.
For these reasons I consider my answer deserves to be the accepted answer.
John BG

John BG on 18 Dec 2016
Hi Basa
got you this
the upload does not accept Simulink file name extensions (!?) people compress and upload but it should be straight forward to upload MATLAB related files with MATLAB file name extensions, shouldn't it?
Well, if this answer helps you with this question, would you please be so kind to mark my answer as accepted?
thanks for attention, awaiting answer