Need help with an integral interval

hey i have this matlab script that work fine, but i found out that my interval is wrong now i integrate from -d to a. in real i need from -d to a*sin(w*t) where d,a and w is known but t is variable or linspace from 0 to 30. see script bellow: PS need to change F at the bottom.
clear all
clear variables
clc
H100 = 28.6083; % Intermediate Water
C100 = 17.8718;
Tmin = 13.6365;
Tmax = 17.7395;
Tmean = 15.6880;
%--------------------------------------------------------------------------
d = 100; % water depth
T = Tmin; % wave period
a = H100/2; % or C100 % wave amplitude
g = 9.81; % acceleration of gravity
% x = direction of propagation
% t = time
w = 2*pi/T; % wave frequency
syms k
k1 = solve(g*k*tanh(k*d)-w^2 == 0, k);
k = sqrt(k1.^2); % wave number
L = simple(((g*T.^2)*tanh(k*d))/(2*pi)); % wave length
% Morison equation data
D = 1; % Diameter on column: D = 1m= drag, D = 5m= drag/mass, and D = 20m= mass
p = 1025;
Cm = 2;
Cd = 1.1;
%--------------------------------------------------------------------------
% Velocity = V % Acceleration = A
t = linspace(0,30);
x = 0;
syms z
V1 = (((a*k*g*cosh(k*(z+d)))/(w*cosh(k*d)))*sin(w*t-k*x)); % Extrapolation above free surface
V2 = ((a*k*g*cosh(k*(((z-a)/(1+a/d))+d)))/(w*cosh(k*d))*sin(w*t-k*x)); % Wheeler stretching
V3 = (((a*k*g*cosh(k*(0+d)))/(w*cosh(k*d)))*sin(w*t-k*x)); % z = 0 constant value used for surface
A1 = ((a*k*g*cosh(k*(z+d)))/(cosh(k*d)))*cos(w*t-k*x); % Extrapolation above free surface
A2 = ((a*k*g*cosh(k*(((z-a)/(1+a/d))+d)))/(cosh(k*d)))*cos(w*t-k*x); % Wheeler stretching
A3 = ((a*k*g*cosh(k*(0+d)))/(cosh(k*d)))*cos(w*t-k*x); % z = 0 constant value used for surface
%--------------------------------------------------------------------------
% Tmin for H100
Fm = (pi*p*Cm*A1*D.^2)/4;
Fd = ((p*Cd*D)/2)*V1.*(abs(V1));
F = int(Fm,z,-d,a*t)+int(Fd,z,-d,a*t);
[MaxValue_H100_Tmin_Extr, Index_At_F] = max(double(F))
t_Position_of_MaxValue_H100_Tmin_Extr = t(Index_At_F)
% i need to write somthing like( see bellow): but this makes an error.
%a1 = a*sin(w*t);
%F = int(Fm,z,-d,a1)+int(Fd,z,-d,a1);

4 Kommentare

Konstantinos Sofos
Konstantinos Sofos am 19 Mär. 2015
What is the error? May you have to debug your script, so that you can understand what is going wrong with the dimensions...
i can shorten my script see it got some errors inn it when i copyed it:
clear all
clear variables
clc
H100 = 28.6083; % Intermediate Water
Tmin = 13.6365;
%--------------------------------------------------------------------------
d = 100; % water depth
T = Tmin; % wave period
a = H100/2; % or C100 % wave amplitude
g = 9.81; % acceleration of gravity
% x = direction of propagation
% t = time
w = 2*pi/T; % wave frequency
syms k
k1 = solve(g*k*tanh(k*d)-w^2 == 0, k);
k = sqrt(k1.^2); % wave number
L = simple(((g*T.^2)*tanh(k*d))/(2*pi)); % wave length
% Morison equation data
D = 1;
p = 1025;
Cm = 2;
Cd = 1.1;
%--------------------------------------------------------------------------
% Velocity = V % Acceleration = A
t = linspace(0,30);
x = 0;
syms z
V1 = (((a*k*g*cosh(k*(z+d)))/(w*cosh(k*d)))*sin(w*t-k*x));
A1 = ((a*k*g*cosh(k*(z+d)))/(cosh(k*d)))*cos(w*t-k*x);
%--------------------------------------------------------------------------
% Tmin for H100
Fm = (pi*p*Cm*A1*D.^2)/4;
Fd = ((p*Cd*D)/2)*V1.*(abs(V1));
F = int(Fm,z,-d,a)+int(Fd,z,-d,a);
[MaxValue_H100_Tmin_Extr, Index_At_F] = max(double(F))
t_Position_of_MaxValue_H100_Tmin_Extr = t(Index_At_F)
every thing works fine above, but i wont to change the end interval of my integrals. see F has integral to a. i wont to change this to:
%a1 = a*sin(w*t);
%F = int(Fm,z,-d,a1)+int(Fd,z,-d,a1);
but this makes an error saying:
Error using mupadmex
Error in MuPAD command: The argument is invalid. [Dom::Interval::new]
Error in sym/int (line 124)
rSym = mupadmex('symobj::intdef',f.s,x.s,a.s,b.s,options);
Error in ekko (line 50)
F = int(Fm,z,-d,a1)+int(Fd,z,-d,a1);
To eval symbolic expressions to specific values of the symbolic variables you can try
F = eval('int(Fm,z,-d,a1)+int(Fd,z,-d,a1)')
F = eval('int(Fm,z,-d,a1)+int(Fd,z,-d,a1)')
dosent work for me.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Gefragt:

am 19 Mär. 2015

Kommentiert:

am 19 Mär. 2015

Community Treasure Hunt

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

Start Hunting!

Translated by