Dear all, I am a Technology aspirant currently working with Cybermarine. I have done my MS (by Research) in Ocean Engg. from Department of IIT Madras (INDIA). I have dedicated this blog specially to discuss various problems in Dynamics of Offshore structures with use of different softwares.
Sunday, 19 February 2017
Thursday, 16 February 2017
MATLAB SCRIPT TO CHANGE TIME TO FREQUENCY DOMAIN
JUST COPY AND PASTE THE BELOW CODE
clc
clear all
close all
HS=5;
pcf=0.3;
cf1=0.1;
cf2=1.5;
n=100;
t=0:1:2000;
dt=t(2)-t(1);
dcf=(cf2-cf1)/(n-1);
omega=cf1:dcf:cf2;
nomega=length(omega);
cc=(5/16)*(HS^2);
sdeta=(cc)*((pcf^4)*(omega.^-5)).*(exp(-1.25*((pcf^4)*(omega.^-4))));
figure
plot(omega,sdeta,'k');
xlabel('\omega (rad/sec)')
ylabel('S_\eta_\eta (m^2sec)')
grid on
pheta=rand(nomega,1)*2*pi;
df=omega(2)-omega(1);
ns=length(sdeta);
w=omega;
tl=length(t);
for i=1:tl
x1(i)=0;
for j=1:n
a1(j)=sqrt(2*sdeta(j)*df);
x1(i)=x1(i)+a1(j)*cos(-w(j)*(t(i))+pheta(j));
end
end
figure
plot(t,x1,'k')
xlabel('t (sec)')
ylabel('\eta (m)')
grid on
clc
clear all
close all
HS=5;
pcf=0.3;
cf1=0.1;
cf2=1.5;
n=100;
t=0:1:2000;
dt=t(2)-t(1);
dcf=(cf2-cf1)/(n-1);
omega=cf1:dcf:cf2;
nomega=length(omega);
cc=(5/16)*(HS^2);
sdeta=(cc)*((pcf^4)*(omega.^-5)).*(exp(-1.25*((pcf^4)*(omega.^-4))));
figure
plot(omega,sdeta,'k');
xlabel('\omega (rad/sec)')
ylabel('S_\eta_\eta (m^2sec)')
grid on
pheta=rand(nomega,1)*2*pi;
df=omega(2)-omega(1);
ns=length(sdeta);
w=omega;
tl=length(t);
for i=1:tl
x1(i)=0;
for j=1:n
a1(j)=sqrt(2*sdeta(j)*df);
x1(i)=x1(i)+a1(j)*cos(-w(j)*(t(i))+pheta(j));
end
end
figure
plot(t,x1,'k')
xlabel('t (sec)')
ylabel('\eta (m)')
grid on
Subscribe to:
Comments (Atom)
