![Untitled.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/226957/Untitled.png)
Change of surface in a rectangular tank
2 次查看(过去 30 天)
显示 更早的评论
I am plotting a change of surface in terms of beta
The thing is I see no change in the figure when I change the values of beta
Can you help me please
here is the code
clear
x=pi
x0=0.05;
omega=3;
beta0=0.1;
g=10;
z0=(1-(beta0*g)*omega^(-2))^0.5;
h=1;
b=4*(omega^(2))*x0*(g*pi)^(-1)
h=1;
g=10 ;
N=2;
syms t x z0
z0=0;
for n=0:N;
Z=((2*n+1)^(-2))*cos((2*n+1)*x)*cosh(z0*(2*n+1)*((cosh((2*n+1)*z0*h)-g*(2*n+1)*sinh((2*n+1)*z0*h)*(pi^(2)*z0)^(-1))^(-1)))*sin(t);
Zf=z0+Z;
end
Z=simplify(Zf);
Z1=subs(Z,x,pi);
t=0:0.02:20;
x=0:0.02:pi;
[T,X]=meshgrid (t,x);
for n=0:N;
Z=((2*n+1)^(-2))*cos((2*n+1).*X)*cosh(z0*(2*n+1)*((cosh((2*n+1)*z0*h)-g*(2*n+1)*sinh((2*n+1*z0)*h)*(pi^(2)*z0)^(-1))^(-1))).*sin(T);
Zf=z0+Z;
end
a=(omega^(2))*x0*(X-0.5*pi)*g^(-1);
Z=a.*sin(T)+b*Z;
mesh(T,X,Z)
grid on
title('evolution spaciotemporelle de la surface libre');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/226894/image.png)
0 个评论
采纳的回答
darova
2019-6-30
I suggest you to clarify your code. There are some errors i think
x=pi
x0=0.05;
omega=3;
beta0=0.1;
g=10;
z0=(1-(beta0*g)*omega^(-2))^0.5;
h=1;
b=4*(omega^(2))*x0*(g*pi)^(-1)
h=1; % again
g=10 ; % declaring the same variable
N=2;
syms t x z0 % declaring symbolic variable
% and re-write them?
z0=0; % re-write z0? It's symbolic
for n=0:N;
Z=((2*n+1)^(-2))*cos((2*n+1)*x)*cosh(z0*(2*n+1)*((cosh((2*n+1)*z0*h)-g*(2*n+1)*sinh((2*n+1)*z0*h)*(pi^(2)*z0)^(-1))^(-1)))*sin(t);
Zf=z0+Z; % you mean Zf=Zf+Z ?
end
Z=simplify(Zf);
Z1=subs(Z,x,pi); % substitute only x variable (t remains)
t=0:0.02:20;
x=0:0.02:pi;
[T,X]=meshgrid (t,x);
for n=0:N;
% overwrite Z variable? Z has some value already
Z=((2*n+1)^(-2))*cos((2*n+1).*X)*cosh(z0*(2*n+1)*((cosh((2*n+1)*z0*h)-g*(2*n+1)*sinh((2*n+1*z0)*h)*(pi^(2)*z0)^(-1))^(-1))).*sin(T);
Zf=z0+Z;
end
Pay attention to warnings
![Untitled.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/226957/Untitled.png)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!