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

6 comments:

  1. Hi utkarsh, i am currently pursuing my m.tech in iit madras, i tried contacting you from many means,but seems you are very busy i am working on offshore wind turbine mounted on a triceratop, which would include the coupled simulation between ansys aqwa and fast, i would like to know how can i couple my aqwa model with fast and also i am not aware of converting the aqwa format to wamit format, plz help me on this ,as i spoke to multiple people and they said you are the best one to guide me , kindly reply as soon as possible

    ReplyDelete
    Replies
    1. Hi purushottam, we can not integrate aqwa to fast you have to use wamit only, however if you want you can arrange aqwa output in a similar format as that of wamit.

      Delete
    2. thanks a lot for reply, please provide me your number, so that i can speak to you,also can you give me a step by step procedure to do so, kindly rply as soon as possible

      Delete
    3. how can i arrange aqwa format in a similar format as that of wamit

      Delete
  2. And one more thing utkarsh the code you have provided is for the wave elevation and the power spectral density of it how do i modify it fo my own excel data, kindly reply

    ReplyDelete
  3. thanks a lot for reply, please provide me your number, so that i can speak to you,also can you give me a step by step procedure to do so, kindly rply as soon as possible,
    how can i arrange aqwa format in a similar format as that of wamit

    ReplyDelete