Substitute term with variable

3 views (last 30 days)
Magnus
Magnus on 9 Oct 2014
Commented: Magnus on 10 Oct 2014
Dear all,
I'm trying to substitute a rather long term
(L/T*z-U(i-1)*z-(Ui(i)-Ui(i-1))/(di(i-1)-di(i))*(z^2/2+di(i-1)*z)+ ...
(Xi(i)*sinh(2*pi*z/L)+Yi(i)*cosh(2*pi*z/L))*cos(2*pi*x/L)
with one variable, Psi(i). I tried on Mupad using subsex, but this doesn't work. I know, however, if you re-arrange the equation below, that the term given above exists. There is probably no explicit matlab/mupad function that could handle the issue (is there??) but maybe you came across with a procedure that solves the problem. Also maybe in more general terms.
The idea behind all this is, that I want to differentiate the equation below with respect to Psi. Therefore, I thought re-arranging would be the most applicable approach, but, again, I'd also appreciate other ideas.
Thanks a lot in advance, Cheers,
&nbsp
(int(((int(((-Ui(4.0)+L/T+cos((pi*x*2.0)/L)*((pi*Xi(5.0)*...
cosh((H*pi*cos((pi*x*2.0)/L))/L)*2.0)/L+(pi*Yi(5.0)*...
sinh((H*pi*cos((pi*x*2.0)/L))/L)*2.0)/L)+((Ui(4.0)-Ui(5.0))*(di(4.0)+...
H*cos((pi*x*2.0)/L)*(1.0/2.0)))/(di(4.0)-di(5.0)))^2*(1.0/2.0)+...
1.0/L^2*pi^2*sin((pi*x*2.0)/L)^2*(Yi(5.0)*...
cosh((H*pi*cos((pi*x*2.0)/L))/L)+Xi(5.0)*...
sinh((H*pi*cos((pi*x*2.0)/L))/L))^2*2.0)/g+H*cos((pi*x*2.0)/L)*...
(1.0/2.0),x,0.0,L*(1.0/2.0))*-2.0)/L+((-Ui(4.0)+L/T+cos((pi*x*2.0)/L)*...
((pi*Xi(5.0)*cosh((H*pi*cos((pi*x*2.0)/L))/L)*2.0)/L+(pi*Yi(5.0)*...
sinh((H*pi*cos((pi*x*2.0)/L))/L)*2.0)/L)+((Ui(4.0)-Ui(5.0))*...
(di(4.0)+H*cos((pi*x*2.0)/L)*(1.0/2.0)))/(di(4.0)-di(5.0)))^2*...
(1.0/2.0)+1.0/L^2*pi^2*sin((pi*x*2.0)/L)^2*(Yi(5.0)*...
cosh((H*pi*cos((pi*x*2.0)/L))/L)+Xi(5.0)*sinh((H*pi*...
cos((pi*x*2.0)/L))/L))^2*2.0)/g+H*cos((pi*x*2.0)/L)*...
(1.0/2.0))^2,x,0.0,L*(1.0/2.0))*2.0)/L;
  2 Comments
José-Luis
José-Luis on 9 Oct 2014
I don't understand the problem, sorry. Why don't you make the "term" a function of i and call it when needed.
Magnus
Magnus on 10 Oct 2014
Because Psi is differentiated before. The problem is something like this: diff(diff(Psi,x),Psi). In order to do the d/dPsi I would like to re-collect the definition of Psi, see above, and then substitute this expression with Psi again.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!