Filter löschen
Filter löschen

Puzzling-Why am I not able to integrate?

3 Ansichten (letzte 30 Tage)
Vignesh Kumar
Vignesh Kumar am 15 Apr. 2016
Hello All, This code generates the wave elevation at every instant from a given irregular sea spectrum.
maxT = 100; dt = 0.005; N = 100; HS = 5; TZ = 5; g=9.8;
% Time and x-vector with increment dt: x = 0:dt:maxT; t = 0:dt:maxT;
% Finding random phase angles (epsilon):
eps = rand(N,1)*2*pi;
% Delta omega: domega = (2.4-0.2)/(N-1);
% Creating a vector of amplitudes: zetaa = zeros(N,1);
% Calculating the amplitudes from the B.S wave spectrum:
S = @(omega)((HS^2*TZ)/(8*pi^2)*((2*pi/(omega*TZ)).^5)*exp((-(1/pi)*((2*pi/omega*TZ)).^4)));
for i=1:N lower = (i-1)*domega; upper = i*domega; int = integral(S,lower,upper,'ArrayValued',true); zetaa(i) = sqrt(2*int); end
disp('zetaa:') disp(zetaa)
Im puzzled as to why int doesn't return a value for my attempt to integrate . Please help me find my mistake.
Thanks.

Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by