Error using / matrix dimensions must agree
1 回表示 (過去 30 日間)
古いコメントを表示
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
0 件のコメント
採用された回答
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!