필터 지우기
필터 지우기

my plot is not sinusoidal wave

조회 수: 2 (최근 30일)
MOUNIBA REDAH
MOUNIBA REDAH 2020년 2월 15일
댓글: MOUNIBA REDAH 2020년 2월 16일
hello can you please help me?? when i type this code i only get an horizontal line
i don`t know where is my mistake
the code
clc
sigma0=0;
sigma1=100;
sigma2=500;
el=0.5*0.0001;
L=1*0.0001 ;
h=0.5*0.0001;
a=1;
rho=1000;
g=10;
t=300;
m=4;
n=4;
x=0:100:5000;
A=(pi*((m/el)^(2)+(n/L)^(2))^(0.5));
B0=(g*A+(sigma0/rho).*A^3).*atan(A*h);
C0=B0^(0.5);
Z0=a*cos(C0.*t).*cos((m*pi.*x)/el);
B1=(g*A+(sigma1/rho)*A^3)*atan(A*h*1/180);
C1=B1^(0.5);
Z1=a*cos(C1.*t).*cos((m*pi.*x)/el);
B2=(g*A+(sigma2/rho)*A^3)*atan(A*h);
C2=B2^(0.5);
Z2=(a*cos(C2.*t).*cos((m*pi.*x)/el));
subplot(2,2,1)
plot(x,Z0,'r',x,Z1,'g',x,Z2,'b');
xlabel(' paroi x');
ylabel(' elevation z');
legend('sigma=0',' sigma=100',' sigma=500')

채택된 답변

darova
darova 2020년 2월 15일
Your argument for cos is too big
Try
x = linspace(0,5e-5,50);
The result
  댓글 수: 1
MOUNIBA REDAH
MOUNIBA REDAH 2020년 2월 16일
Ok thank you for your help
I will try it

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Giuseppe Inghilterra
Giuseppe Inghilterra 2020년 2월 15일
Hi,
the argument of cosine "(m*pi.*x)/el" returns you always one.
This happens because your cosine argument is expressed in the form 'k*pi' with k = even integer number. In this case cos(k*pi) (with k = even integer number) returns you always one.
If you try to change parameter m or el or step of x such that m*x/el is not an even interger number you obtain a wave plot.
For example with: x = 0:pi:5000, you obtain the following result:
  댓글 수: 1
MOUNIBA REDAH
MOUNIBA REDAH 2020년 2월 16일
Ok thank you for your help
I see now where is my mistake

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Axes Appearance에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by