필터 지우기
필터 지우기

How can I plot this exponential decaying sinusoid

조회 수: 7 (최근 30일)
Nabin SUNAM
Nabin SUNAM 2015년 1월 30일
댓글: Mischa Kim 2015년 1월 31일
y(x) = F * exp^(-a*x) * sin(bx)
pick you own values for x vector.
value of a and b:
ethyl alcohol 0.246 0.806
water 0.250 1.000
Oil 0.643 1.213
plot using the values above for each fluid.
Here is a portion of my approach.
extf = input('Please enter the magnitude of the external force: ');
yethylalchol == extf*exp(-0.246*x).*sin(0.806*x);
plot( x,yethylalcohol,'c*' )
hold on
ywater == extf*exp(-0.250*x).*sin(1*x);
plot( x,ywater,'r+' )
hold on
yoil == extf*exp(-0.643*x).*sin(1.213*x);
plot( x,yoil, 'yp')
What am I doing wrong? Help please!!!

채택된 답변

Mischa Kim
Mischa Kim 2015년 1월 30일
Nabin, how about
% value of a and b:
% ethyl alcohol 0.246 0.806
% water 0.250 1.000
% Oil 0.643 1.213
F = 1;
x = 0:0.1:2*pi;
a = [0.246 0.250 0.643]';
b = [0.806 1.000 1.216]';
y = F * exp(-a*x).*sin(b*x);
plot(x,y)

추가 답변 (1개)

Nabin SUNAM
Nabin SUNAM 2015년 1월 30일
Thanks Miscah for the try. I tried to run this script and this is the message I'm getting.
"Error using *
Inner matrix dimensions must agree."
I wonder what it means.
  댓글 수: 1
Mischa Kim
Mischa Kim 2015년 1월 31일
Nabin, did you re-type the script (as opposed to doing a copy-paste)? You might have missed a dot or prime.

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

카테고리

Help CenterFile Exchange에서 Fluid Dynamics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by