필터 지우기
필터 지우기

Puzzling-Why am I not able to integrate?

조회 수: 3 (최근 30일)
Vignesh Kumar
Vignesh Kumar 2016년 4월 15일
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개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by