How can i correct this error "Parse error ´(´"

조회 수: 7 (최근 30일)
Ana María Hernández Salinas
Ana María Hernández Salinas 2021년 3월 12일
Ok so basically my problem is that while i was writing some functions i got this error "Invalid expression", it says in what line is the problem, but personally i have corrected it a couple times now and still the same, this is my code: (else function)
if fB==0
y=(B/A)*x;
elseif fB==pi/2
y=sqrt(B.^2*(1-((x.^2)/A.^2)));
elseif fB==pi
y=-(B/A)*x;
else
y = A*B*x*cos(fB)-sqrt((A.^2)*B.^2*(A.^2)*sin^2(fB)+(x.^2)*cos^2(fB)-x.^2)/(A.^2);
end

채택된 답변

KSSV
KSSV 2021년 3월 12일
편집: KSSV 2021년 3월 12일
x=A*sin(w*t+fA);
y=B*cos(w*t+fB);
if fB==0
y=(B/A)*x;
elseif fB==pi/2
y=sqrt(B.^2*(1-((x.^2)/A.^2)));
elseif fB==pi
y=-(B/A)*x;
else
y = A*B*x*cos(fB)-sqrt((A.^2)*B.^2*(A.^2)*sin(fB)^2+(x.^2)*cos(fB)^2-x.^2)/(A.^2); %<-- change here
end
  댓글 수: 1
Ana María Hernández Salinas
Ana María Hernández Salinas 2021년 3월 12일
oh i see now the problem, the sin and cos, thank you very much, have a great night

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by