Solving 1 equation with 1 unknown

1 visualización (últimos 30 días)
Cizzxr el 19 de Mzo. de 2021
Respondida: David Hill el 19 de Mzo. de 2021
Hi, so i have a 11 values
[-0.5,-0.4,-0.3,-0.2,-0.1,0,0.1,0.2,0.3,0.4,0.5]
or -0.5:0.1:0.5
Lets assign these to a variable 'a'
I then have an equation which is as follows;
(125./216)*((1+0.2*((M).^2)).^3)*1./M
I want to simply make 'a' = to this equation for each value of 'a' and solve for M at each 'a' value.
I then want to plot a graph of my the values 'a' against M.
The equation ive used is as follows where the y is equal to 1.4, but ive already simplified this above. Could you please check i have simplified it correct into matlab as i feel it may be wrong
0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Respuestas (1)

David Hill el 19 de Mzo. de 2021
a=-0.5:0.1:0.5;
for k=1:length(a)
eqn=@(M)(125/216)*((1+0.2*(M.^2)).^3)./M-a(k);
sol(k)=fzero(eqn,1);
end
plot(a,sol);
0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by