Impact-Site-Verification: dbe48ff9-4514-40fe-8cc0-70131430799e

Search This Blog

Sea surface animation using random number and sine waveform in MATLAB


Code:

clc
clear all
close all
figure;
pause(5);
z=rand(1,100);
for i=1:100
    if(rem(i,2)==0)
        fill([-10 -10 10 10],[0 10  10 0],'k');
axis([-10 10 0 10]);
hold on;
t=-10:0.01:10;
x=5-z(i)*abs(sin(t));
area(t,x);
    else
        fill([-10 -10 10 10],[0 10  10 0],'k');
axis([-10 10 0 10]);
hold on;
t=-10:0.01:10;
x=5-z(i)*abs(sin(t+pi/2));
area(t,x);
    end
    pause(0.4);
    clf
end


No comments

Popular Posts

Followers