필터 지우기
필터 지우기

need to solve for a variable numerically

조회 수: 1 (최근 30일)
joshua payne
joshua payne 2022년 10월 10일
답변: David Hill 2022년 10월 10일
need to solve for M1 based off data and equations.
gamma=1.4;
M=((((Po./P).^((gamma-1)./gamma)-1)*2)/(gamma-1)).^(1/2);
Msonic=find(abs(M-1)<.005)
values=M(305)
values=M(696)
Po1=P.*(1+((gamma-1)/2).*M.^2);
index1=1:304; %subsonic
index2=697:1000;%subsonic
index3=305:696; %supersonic
figure
plot(t(index1),M(index1), 'b')
hold on
plot(t(index2),M(index2), 'b')
plot(t(index3),M(index3), 'r')
M2=((((M1).^(2))+(2/(gamma-1)))./((((2*gamma)/(gamma-1)).*(M1).^2)-1))
pr=Po(index3)./P(index3)
preq=((1+((gamma-1)/2).*M2.^2)^(gamma/gamma-1)).*(((gamma+1).*M1.^2)/(2+(gamma-1).*M1.^2))
syms M1 pr gamma
eqn=preq==pr
pretty(eqn)
superM=vpasolve(eqn,M1, 'real')
for index3 i need to solve for M1. pr is calculated using the attached excel document data. Po is stagnation pressure, P is static pressure, t are the indexes.

답변 (1개)

David Hill
David Hill 2022년 10월 10일
m=readmatrix('HW_3_problem_2_data.xlsx');
index3=305:696;
pr=m(index3,2)./m(index3,3);
gamma=1.4;
syms M1
M2=((((M1).^(2))+(2/(gamma-1)))./((((2*gamma)/(gamma-1)).*(M1).^2)-1));
preq=((1+((gamma-1)/2).*M2.^2)^(gamma/gamma-1)).*(((gamma+1).*M1.^2)/(2+(gamma-1).*M1.^2));
for k=1:length(pr)
superM(k,:)=vpasolve(preq==pr(k),M1);
end

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by