I have to plot the function y=Mt*(1/ec)*(1/sqrt(1-((ec-h)./ec).^2)) but it gives me this error, where did I go wrong

 채택된 답변

Star Strider
Star Strider 2022년 11월 15일
The ‘y’ expression is not a function of ‘x’.
Correcting that (and assuming the independent variable is actually ‘ec’) —
ec = linspace(0, 0.035, 50);
Mt = rand; % Missing Value
h = rand; % Missing Value
y=Mt*(1./ec).*(1./sqrt(1-((ec-h)./ec).^2));
figure
plot(ec, real(y), 'DisplayName','Real')
hold on
plot(ec, imag(y), 'DisplayName','Imaginary')
hold off
ylim([-1 1])
legend('Location','best')
There were also some missing element-wise operators.
.

댓글 수: 2

Adolfo Marro
Adolfo Marro 2022년 11월 15일
It works, I had to pay attention to "./", thank you
Star Strider
Star Strider 2022년 11월 15일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

제품

릴리스

R2022a

질문:

2022년 11월 15일

댓글:

2022년 11월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by