필터 지우기
필터 지우기

Solving 1 equation with 1 unknown

조회 수: 1 (최근 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