Puzzling-Why am I not able to integrate?
조회 수: 1 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!