행렬값으로 미지수 3개 구하기

4 次查看(过去 30 天)
찬양 곽
찬양 곽 2022-6-18
E식에서 나온 행렬값이 fx2식과 같다고 해서 미지수 Crp,Frp,Cd를 구하고 싶은데 어떻게 해야 할까요?
v=10;
M=80;
theta=0;
p=1.1839;
t=[0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0];
x=[1 3 5 7 9 11 13 15 17 19 21];
E=0.05*v*(4.75*t+0.091);
disp(E)
fx1=@(t) M*v(a+sin(theta));
Et2=E;
fx2=@(t) Crp*Frp*v+1/2*(p*Cd*v^3*A);
Et1=quad(fx1,0.1,1);
Et2=quad(fx2,0.1,1)
for i=1:10
a=(3*f(i)-4*f(i-1)+f(i-2))/2*delx;
end
fx1=@(t) M*v(a+9.81*sin(theta));
fx2=@(t) Crp*Frp*x*log(t2/t1)-p*Cd*x^3*A*(t2^(-2)-t1^(-2));
Et1=integral(fx1,0.1,1);
Et2=integral(fx2,0.1,1);
ET=Et1+Et2;

回答(1 个)

sai charan sampara
sai charan sampara 2023-10-13
Hello 찬양 곽,
I understand that you are trying to find the values of 3 unknowns “Crp”, “Frp” and “Cd” using some equations.
There are some errors in the code which needs to be fixed first. In line 9 and 17 in the definition of function handle “fx1” a multiplication symbol “*” is missing after variable “v” because v is a scalar and parenthesis usage is done for indexing arrays. It can be fixed as follows:
fx1=@(t) M*v*(a+9.81*sin(theta));
The array “f” was not defined and used directly in the “for” loop, this will give an error. Also, the loop index should be starting from 3 and not 1 because there is a term “i-2” used for indexing f. In MATLAB indexing starts from 1 so “i-2” cannot go below 1. “Et2” was initially equated to “E” but later just overwritten. There might be some logical error here. MATLAB uses BODMAS to solve algebraic equations so use parenthesis whenever necessary in the function handle definitions and other portions of the code.
After fixing these errors and the logic, the equations can be solved by using the general method for solving any system of equations. For solving this problem, you need values of 3 unknown variables. It is done as follows. You need some equations having these unknown variables that equate to a constant value. These equations govern the values of the variables. You must write the equations with these variables in “== 0” format. Then these equations can be solved by using MATLAB functions like “vpasolve”, “fsolve”, etc.
You can refer to the below documentation to learn more about solving equations in MATLAB.
Hope this helps.
Thanks,
Charan.

类别

Help CenterFile Exchange 中查找有关 상미분 방정식 的更多信息

Community Treasure Hunt

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

Start Hunting!