Azzera filtri
Azzera filtri

Puzzling-Why am I not able to integrate?

3 visualizzazioni (ultimi 30 giorni)
Vignesh Kumar
Vignesh Kumar il 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.

Risposte (0)

Categorie

Scopri di più su Mathematics in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by