Error using / matrix dimensions must agree

5 visualizaciones (últimos 30 días)
Adolfo Marro
Adolfo Marro el 15 de Nov. de 2022
Comentada: Star Strider el 15 de Nov. de 2022
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

Respuesta aceptada

Star Strider
Star Strider el 15 de Nov. de 2022
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 comentarios
Adolfo Marro
Adolfo Marro el 15 de Nov. de 2022
It works, I had to pay attention to "./", thank you
Star Strider
Star Strider el 15 de Nov. de 2022
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by