Matlab / Mupad does not solve definite integral

3 Ansichten (letzte 30 Tage)
Magnus
Magnus am 9 Okt. 2014
Kommentiert: Magnus am 14 Okt. 2014
Dear all,
I'm trying to solve an integral using both matlab and mupad. However it does not solve the integral although it is definite. It basically just simplifies the expression and returns something like
(int((Ub-Ui(i)+cos((pi*x*2.0)/L)*((pi*Xi(i+1.0)*cosh((H*pi*cos((pi*x*2.0)/L))/L)*2.0)/L+(pi*Yi(i+1.0)*sinh((H*pi*cos((pi*x*2.0)/L))/L)*2.0)/L)-cos((pi*x*2.0)/L)*((pi*Xi(1.0)*cosh((H*pi*cos((pi*x*2.0)/L))/L)*2.0)/L+(pi*Yi(1.0)*sinh((H*pi*cos((pi*x*2.0)/L))/L)*2.0)/L)+((di(i)+H*cos((pi*x*2.0)/L)*(1.0/2.0))*(Ui(i+1.0)-Ui(i)))/(di(i+1.0)-di(i))-((Ub-Ui(1.0))*(d+H*cos((pi*x*2.0)/L)*(1.0/2.0)))/(d-di(1.0)))^2,x,0.0,L*(1.0/2.0))*2.0)/L;
Does anybody know how to 'force' Matlab/Mupad to give a solution?
Kind regards,
  2 Kommentare
Bruno Pop-Stefanov
Bruno Pop-Stefanov am 10 Okt. 2014
Can you please copy and paste the code to compute the integral so we can take a look? Thanks.
Magnus
Magnus am 14 Okt. 2014
Dear Bruno, of course. Sorry for that.
g=9.81;
Us=5;
Ui=[0.07*Us 0.1*Us 0.2*Us 0.5*Us Us];
Ub=0.02;
H=7.5;
d=50;
di=[0.8*d 0.6*d 0.4*d 0.2*d 0];
Xi=[X1 X2 X3 X4 X5];
Yi=[Y1 Y2 Y3 Y4 Y5];
syms L x Xi X1 X2 X3 X4 X5 Yi Y1 Y2 Y3 Y4 Y5
i=2; %to cut time, it's actually a for-loop
E2=(int((Ub-Ui(i)+cos((pi*x*2.0)/L)*((pi*Xi(i+1.0)*cosh((H*pi*cos((pi*x*2.0)/L))/L)*2.0)/L+(pi*Yi(i+1.0)*sinh((H*pi*cos((pi*x*2.0)/L))/L)*2.0)/L)-cos((pi*x*2.0)/L)*((pi*Xi(1.0)*cosh((H*pi*cos((pi*x*2.0)/L))/L)*2.0)/L+(pi*Yi(1.0)*sinh((H*pi*cos((pi*x*2.0)/L))/L)*2.0)/L)+((di(i)+H*cos((pi*x*2.0)/L)*(1.0/2.0))*(Ui(i+1.0)-Ui(i)))/(di(i+1.0)-di(i))-((Ub-Ui(1.0))*(d+H*cos((pi*x*2.0)/L)*(1.0/2.0)))/(d-di(1.0)))^2,x,0.0,L*(1.0/2.0))*2.0)/L;

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Bruno Pop-Stefanov
Bruno Pop-Stefanov am 10 Okt. 2014
If you want to "force" MATLAB to give a numeric solution to an integral, you can use the integral function, which computes the integral numerically, as opposed to int and MuPAD, which try to solve the integral symbolically.
Here is a page with the list of numerical integration functions and links to examples:
  1 Kommentar
Magnus
Magnus am 14 Okt. 2014
Dear Bruno, thanks for your answer! The problem is that for the equation above, I want to solve for L in the next step after the integration from x=0 to x=L/2. I also intend to do so for X1, ...Y5. Numerical integration using integral or quadqk, however, requires only one variable, so I can't keep L, X1,...Y5 as variables but have assign them real values. So I keep x and assign constants to all the other syms values, which works (after transformation to a function handle). I tried to remain L, X1, Y1, etc., as syms but then integral, quadgk etc. wouldn't work.
Cheers

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by