Solving 1 equation with 1 unknown

2 次查看(过去 30 天)
Cizzxr
Cizzxr 2021-3-19
回答: David Hill 2021-3-19
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

回答(1 个)

David Hill
David Hill 2021-3-19
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);

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by