Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Please help me write the f function in matlab

조회 수: 6 (최근 30일)
Iurie Obodeanov
Iurie Obodeanov 2020년 10월 7일
마감: MATLAB Answer Bot 2021년 8월 20일
  댓글 수: 2
Iurie Obodeanov
Iurie Obodeanov 2020년 10월 7일
Yes, I got to f=2.*x.*sin(6.*pi.*x+exp(2.*x.*cos(6.*pi.*x.))); but something is wrong and I can't quite put my finger on it

답변 (2개)

KSSV
KSSV 2020년 10월 7일
  1. Read about sin, cos
  2. Read about exp.
  3. Read about linspace.
Example: If I want to write a function for sin(pi*x)
m = 100 ;
x = linspace(0,2,m) ;
y = sin(pi*x) ;
plot(x,y)
  댓글 수: 2
Iurie Obodeanov
Iurie Obodeanov 2020년 10월 7일
I got to f=2.*x.*sin(6.*pi.*x+exp(2.*x.*cos(6.*pi.*x.))); but something is wrong, I don't know what
KSSV
KSSV 2020년 10월 7일
Show us the whole code which you tried....so that we cna help you.
m = 100 ; % give your value
x = linspace(0,1,m) ; % give your range for x
f=2*x.*sin(6*pi*x+exp(2*x.*cos(6.*pi*x)));
plot(x,f)
In your line..you have used x. this is not correct. You need not to use pi.*..as pi is only a single number.

James Tursa
James Tursa 2020년 10월 7일
편집: James Tursa 2020년 10월 7일
I would assume from the equation image that the exp( ) stuff maybe should be outside of the sin( ) stuff. E.g.,
f = 2.*x.*sin(6.*pi.*x) + exp(2.*x.*cos(6.*pi.*x));

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by