How can we model this equation in simulink dx/dy + x + y = 1 where x is the input and y is the output.
    11 views (last 30 days)
  
       Show older comments
    
    Basavalingappa Mudhol
      
 on 18 Dec 2016
  
    
    
    
    
    Commented: Raghad
 on 8 Nov 2023
            how to model this equation in simulink dx/dy + x + y = 1
4 Comments
  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
1.- fix your answer
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?
  Raghad
 on 8 Nov 2023
				It is required to solve the following dynamic equation on Matlab/Simulink. submit a report in word for what you have done and submit the Simulink file.
3 dy/dt +2y = x(t)
x(t)=1, y(0)=1
Accepted Answer
  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

3 Comments
  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
More Answers (1)
  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
2 Comments
  Mischa Kim
    
      
 on 18 Dec 2016
				Usage of the derivative block is not a recommended best practice unless absolutely necessary. For more information, check out this answer.
  John BG
      
 on 18 Dec 2016
				Misha please have a look to my comments, the usage of 1/u to invert a derivative is completely erroneous as a I show above. You just found something that algebraically looked like it would work, you plugged it an got an erroneous Simulink circuit, that Basa took as good answer.
Please review you answer and correct accordingly.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


