sinusoidal elevation wave with time

8 Ansichten (letzte 30 Tage)
MOUNIBA REDAH
MOUNIBA REDAH am 25 Mär. 2024
Bearbeitet: VBBV am 26 Mär. 2024
I want a sinusoidal elevation wave which is (yo) with the time function (t) that looks like the image 1 the function is smaller and get bigger but the resultthat i get is a stabilized like in image2
Here the code that I did
x0=0.05;
omega0=3;
beta1=0.3;
g=9.81;
t=0:0.01:20;
z0=(beta1*g*(omega0^(-2))-1)^0.5;
b0=4*(omega0^(2))*x0*(g*pi)^(-1);
h=1;
x=1;
% Calculation of y0
y0=0;
n = 1;
while true
% Calculation of the dependent term
a0=((omega0^(2))*x0*(x-0.5*pi))*g^(-1);
dependent_term =((((2*n+1)^(-2))*cos((2*n+1)*x)*cosh(z0*(2*n+1))*((cosh((2*n+1)*z0*h)-(((2*n+1)*sinh(2*n+1)*g*z0*h)*((pi^(2)*z0)^(-1))))^(-1)))*sin(omega0*t));
y0=a0*sin(omega0*t)+b0*dependent_term;
% Summing the dependent term
y0 = y0 + dependent_term;
% Breaking the loop if the dependent term becomes negligible
if abs(dependent_term) < 1e-6
break;
end
n = n + 1;
end
% Display the result Z
plot(t,y0);
% ylim([-0.05 0.1])
  3 Kommentare
Mathieu NOE
Mathieu NOE am 25 Mär. 2024
then in both lines when you add dependent_term to another variable, and wanted to know what is the realtive weight of both terms that you add
for example , after this line : y0=a0*sin(omega0*t)+b0*dependent_term;
I define the first ratio as : ratio1 = max(abs(b0*dependent_term))./max(abs(a0*sin(omega0*t)));
same , for this second line : y0 = y0 + dependent_term;
I define the second ratio as : ratio2 = max(abs(dependent_term))./max(abs(y0));
so if these ratios are very low, we know that the second term you add in these two lines is probably wrong or not with the right amplitude.
and if we look at the results (see last two figures) , we can actually see that those two ratio values are very low , so what at the end , your y0 is basically only dominated by the sinusoidal term (in bold) : y0=a0*sin(omega0*t)+b0*dependent_term;
code (with ratios display)
x0=0.05;
omega0=3;
beta1=0.3;
g=9.81;
t=0:0.01:20;
z0=(beta1*g*(omega0^(-2))-1)^0.5;
b0=4*(omega0^(2))*x0*(g*pi)^(-1);
h=1;
x=1;
% Calculation of y0
y0=0;
n = 1;
ratio1(n) = 0;
ratio2(n) = 0;
while true
% Calculation of the dependent term
a0=((omega0^(2))*x0*(x-0.5*pi))*g^(-1);
dependent_term =((((2*n+1)^(-2))*cos((2*n+1)*x)*cosh(z0*(2*n+1))*((cosh((2*n+1)*z0*h)-(((2*n+1)*sinh(2*n+1)*g*z0*h)*((pi^(2)*z0)^(-1))))^(-1)))*sin(omega0*t));
y0=a0*sin(omega0*t)+b0*dependent_term;
ratio1(n) = max(abs(b0*dependent_term))./max(abs(a0*sin(omega0*t)));
% Summing the dependent term
y0 = y0 + dependent_term;
ratio2(n) = max(abs(dependent_term))./max(abs(y0));
% Breaking the loop if the dependent term becomes negligible
if abs(dependent_term) < 1e-6
break;
end
n = n + 1;
end
% Display the result Z
plot(t,y0);
% ylim([-0.05 0.1])
figure,semilogy(ratio1)
figure,semilogy(ratio2)
VBBV
VBBV am 26 Mär. 2024
Bearbeitet: VBBV am 26 Mär. 2024
Hi @MOUNIBA REDAH, Are these problems similar ? The below question
clear
el= 0.3;
L= 0.57 ;
h= 0.15;
t=0:0.5:50;
x=0.02;
omega1=6.0578;
omega=1.1*omega1;
g=9.81;
for k = 1:length(t)
K(k) = ((2*k-1)/L)*pi;
omegan(k) = sqrt(g*K(k)*tanh(K(k)*h));
D(k)=(4*omega*(-1)^k-1)/(L*cosh(K(k)*h)*K(k)^2);
C(k)=(omega*D(k)*pi)/(omegan(k)^2-(omega)^2);
A(k)=-C(k) - (D(k)/omega);
z(k,:)=(1/g)*sin(K(k)*(x-(L/2)))*cosh(K(k)*h)*(-A(k)*omegan(k)*sin(omegan(k)*t)+C(k)*omega*sin(omega*t))-(1/g)*A(k)*omega*(x-L/2)*sin(omega*t) ;
end
plot(t,sum(z));grid minor

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Fangjun Jiang
Fangjun Jiang am 25 Mär. 2024
Maybe this example gives you an idea?
t=0:0.01:20;
f1=1;
y1=sin(2*pi*f1*t);
f2=0.05;
y2=sin(2*pi*f2*t);
y0=y1.*y2;
figure(1);plot(t,y0);
% figure(2)
% subplot(1,3,1); plot(t,y1);
% subplot(1,3,2); plot(t,y2);
% subplot(1,3,3); plot(t,y0);

Community Treasure Hunt

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

Start Hunting!

Translated by