Help with solving a system of equations

조회 수: 10 (최근 30일)
Garrett
Garrett 2021년 5월 20일
답변: Stephan 2021년 5월 20일
Hi all,
For my aerodynamics class, I'm trying to solve a system of equations and get a result of something like this:
A1 = 0.239*alpha
A3 = 0.028*alpha
A5 = 0.0038*alpha
and so on up until A19 (the trend continues in odd numbers, i.e. A7, A9, A11, etc.)
The equation I start off with is with different theta values ranging from pi/6, pi/3, up til pi/2. But for some reason i am not getting values for A1, A3, A5, etc. Im quite a novice with MATLAB so im sure there's something im missing but please let me know cause I really need help with this one, and thanks in advance!
%% Case 1: N = 19
clc
clear
AR = 6;
b = 6;
Vinf = 1;
c = 1;
N = 19;
n = 1:2:N;
deltay = b./(N+1);
y0n = -(b./2)+n.*deltay;
theta = acos(-2*y0n/b);
syms alpha A(n)
S1 = symsum(A(n).*sin(n.*(theta)),n,1,N);
S2 = symsum(n.*A(n).*(sin(n.*(theta))./sin((theta))),n,1,N);
eq1 = (2*AR/pi)*S1+S2 == alpha;
[A,b] = equationsToMatrix(eq1, A(n));
x = linsolve (A,b)

채택된 답변

Stephan
Stephan 2021년 5월 20일
Please check carefully if this is correct and if it is what you need:
%% Case 1: N = 19
% clc
% clear
% b = 6;
% Vinf = 1;
% c = 1;
% deltay = b./(N+1);
% y0n = -(b./2)+n.*deltay;
N = 19;
AR = 6;
n =1:2:N;
syms alpha
A = sym('A', [1, N]);
A = A(1:2:end)
A = 
Pi = sym(pi)
Pi = 
π
theta = (linspace((Pi/6),(Pi/2),numel(n)).');
S1 = sum(A.*sin(n.*(theta)));
S2 = sum(n.*A.*(sin(n.*(theta))./sin((theta))));
eq1 = (2*AR/pi)*S1+S2 == alpha;
[A,b] = equationsToMatrix(eq1, A);
x = linsolve (A,b)
x = 
x_num = vpa(x)
x_num = 

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by