How to set the theorem of floquet for Linear variational equation with periodic equation?

19 次查看(过去 30 天)
I'm trying to analyze the stability regions of the equation of motion of a system with periodic coefficients (whirlflutter). I have only written its polynomial equation and examined its roots, but my plot did not match the reference implementation correctly.
If I wanna write the Hill function and use the ode45 code, is it possible for someone to correct my code and my approach to finding the monodromy matrix and calculating the Floquet multipliers?
clc;
clear all;
% Define parameters
N = 2; % Number of blades
I_thetaoverI_b = 2; % Moment of inertia pitch axis over I_b
I_psioverI_b = 2; % Moment of inertia yaw axis over I_b
C_thetaoverI_b = 0.00; % Damping coefficient over I_b
C_psioverI_b = 0.00; % Damping coefficient over I_b
h = 0.3; % rotor mast height, wing tip spar to rotor hub [m]
hoverR = 0.34;
R = h / hoverR; % radius [m]
gamma = 4; % lock number
V_knots = 325; % the rotor forward velocity [knots]
% Convert velocity from [knots] to [meters per second]
% 1 knot = 0.51444 meters per second
V = V_knots * 0.51444;
% Calculate angular velocity in radians per second
omega_rad_s = V / R;
% Convert angular velocity from radians per second to RPM
% 1 radian per second = (60 / (2 * pi)) RPM
Omega = omega_rad_s * (60 / (2 * pi));
freq_1_over_Omega = 1 / Omega;
%the flap moment aerodynamic coefficients for large V
M_b = -(1/10)*V;
M_u = 1/6;
%the propeller aerodynamic coefficients
H_u = V/2;
% Frequency ranges
f_pitch= 5:3:140;
f_yaw= 5:3:140;
divergence_map = [];
Rdivergence_map = [];
unstable = [];
% Modify the loop to iterate over time points
for i = 1:length(f_pitch)
for j = 1:length(f_yaw)
phi_steps = linspace(0, pi, 100); % Time steps within one period
for phi = phi_steps
% Angular frequencies for the current time point
w_omega_pitch = 2 * pi* f_pitch(i);
w_omega_yaw = 2 * pi * f_yaw(j);
K_psi = (w_omega_pitch^2) * I_psioverI_b;
K_theta = (w_omega_yaw^2) * I_thetaoverI_b;
% Define inertia matrix [M]
M_matrix = [I_thetaoverI_b + 1 + cos(2*phi), -sin(2*phi);
-sin(2*phi), I_psioverI_b + 1 - cos(2*phi)];
% Define damping matrix [D]
D11 = C_thetaoverI_b + h^2*gamma*H_u*(1 - cos(2*phi)) - gamma*M_b*(1 + cos(2*phi)) - (2 + 2*h*gamma*M_u)*sin(2*phi);
D12 = h^2*gamma*H_u*sin(2*phi) + gamma*M_b*sin(2*phi) - 2*(1 + cos(2*phi)) - 2*h*gamma*M_u*cos(2*phi);
D21 = h^2*gamma*H_u*sin(2*phi) + gamma*M_b*sin(2*phi) + 2*(1 - cos(2*phi)) - 2*h*gamma*M_u*cos(2*phi);
D22 = C_psioverI_b + h^2*gamma*H_u*(1 + cos(2*phi)) - gamma*M_b*(1 - cos(2*phi)) + (2 + 2*h*gamma*M_u)*sin(2*phi);
D_matrix = [D11, D12;
D21, D22];
% Define stiffness matrix [K]
K11 = K_theta - h*gamma*V*H_u*(1 - cos(2*phi)) + gamma*V*M_u*sin(2*phi);
K12 = -h*V*gamma*H_u*sin(2*phi) + gamma*V*M_u*(1 + cos(2*phi));
K21 = -h*gamma*V*H_u*sin(2*phi) - gamma*V*M_u*(1 - cos(2*phi));
K22 = K_psi - h*gamma*V*H_u*(1 + cos(2*phi)) - gamma*V*M_u*sin(2*phi);
K_matrix = [K11, K12;
K21, K22];
% Compute the system matrices
M11 = M_matrix(1, 1); M12 = M_matrix(1, 2); M21 = M_matrix(2, 1); M22 = M_matrix(2, 2);
D11 = D_matrix(1, 1); D12 = D_matrix(1, 2); D21 = D_matrix(2, 1); D22 = D_matrix(2, 2);
K11 = K_matrix(1, 1); K12 = K_matrix(1, 2); K21 = K_matrix(2, 1); K22 = K_matrix(2, 2);
% Find the roots of the polynomial equation
P0 = M11*M22-M12*M21;
P1 = (- D11*M22*1j - D22*M11*1j + M12*D21*j + D12*M21*j);
P2 = (D11*D22*(1j)^2 - K22*M11 - K11*M22 - D12*D21*(1j)^2 + M12*K21 + M21*K12);
P3 = (D11*K22*1j - D12*K21*1j - D21*K12*1j + D22*K11*1j);
P4 = K11*K22 - K12*K21;
P = roots([P0, P1, P2, P3, P4]);
r = 1 * P;
%Flutter
for k = 1:length(r)
if (real(r(k)) > 0)
if (imag(r(k)) <= 0)
unstable = [unstable; phi, K_psi, K_theta];
% Proximity check for 1/Ω divergence
if abs(real(r(k)) - freq_1_over_Omega) < 0.1
Rdivergence_map = [Rdivergence_map; phi, K_psi, K_theta];
end
end
end
end
%Divergence
if (real(det(K_matrix)) < 0)
divergence_map = [divergence_map; phi, K_psi, K_theta];
end
end
end
end
% Plotting section
figure;
hold on;
scatter(unstable(:,2), unstable(:,3), 'filled');
scatter(divergence_map(:,2), divergence_map(:,3), 'filled', 'r');
scatter(Rdivergence_map(:,2), Rdivergence_map(:,3), 'filled', 'g');
xlabel('K\_psi');
ylabel('K\_theta');
title('Whirl Flutter Diagram');
legend('Flutter area', 'Divergence area', '1/Ω Divergence area');
hold off;
  9 个评论
Umar
Umar 2024-8-5
Hi @Nikoo,
Addressing your query regarding, “Could you explain the logic behind A_new = A - [0, K; Ky, 0]; % Update A matrix with K and Ky values?”
The expression A_new = A - [0, K; Ky, 0] subtracts the values of K and Ky from the corresponding positions in the matrix A. This operation modifies the dynamics of the system represented by A, impacting stability analysis.
Now, coming back to, “I've updated my system to some extent, but I'm facing a major issue that I don't understand the mathematical logic behind it.”
Could you please elaborate further on “I'm facing a major issue that I don't understand the mathematical logic behind it”
Nikoo
Nikoo 2024-8-5
% a periodic matrix
A_top = [zeros(2, 2), eye(2)];
A_bottom = [-inv(M_matrix) * K_matrix, -inv(M_matrix) * D_matrix];
A = [A_top; A_bottom];
% Implement Floquet theory techniques to analyze stability
% Perform stability analysis using Floquet theory
eigenvalues = eig(A); % Compute eigenvalues of matrix A
T = 2*pi; % Period of the coefficients
F = expm(A*T); % Compute the monodromy matrix using Floquet theory
floquet_eigenvalues = eig(F); % Compute Floquet multipliers
A_new = A - [ 0, K_psi; K_theta, 0]; % Update A matrix
F_new = expm(A_new*T); % Compute new monodromy matrix
floquet_eigenvalues_new = eig(F_new); % Compute new Floquet multipliers
I am facing this error: Arrays have incompatible sizes for this operation.
Error in twobladednasapaper (line 108)
A_new = A - [ 0, K_psi; K_theta, 0]; % Update A matrix
my whole script is :
clc
clear all ;
% Define parameters
N = 2 ; %Number of blades
I_thetaoverI_b = 2 ; % Moment of inertia pitch axis over I_b
I_psioverI_b = 2 ; % Moment of inertia yaw axis over I_b
C_thetaoverI_b = 0.00; % Damping coefficient over I_b
C_psioverI_b = 0.00; % Damping coefficient over I_b
h = 0.3; % rotor mast height, wing tip spar to rotor hub
hoverR = 0.34;
R = h / hoverR;
gamma = 4; % lock number
V_knots = 325; % the rotor forward velocity [knots]
% Convert velocity from [knots] to [meters per second]
% 1 knot = 0.51444 meters per second
V = V_knots * 0.51444;
% Calculate angular velocity in radians per second
omega_rad_s = V / R;
% Convert angular velocity from radians per second to RPM
% 1 radian per second = (60 / (2 * pi)) RPM
Omega = omega_rad_s * (60 / (2 * pi));
freq_1_over_Omega = 1 / Omega;
%the flap moment aerodynamic coefficients for large V
M_b = -(1/10)*V;
M_u = 1/6;
%the propeller aerodynamic coefficients
H_u = V/2;
%%%%%%%%%%%the flap moment aerodynamic coefficients for small V
%M_b = -1*(1 + V^2)/8 ;
%M_u = V/4;
%the propeller aerodynamic coefficients
%H_u = (V^2/2)*log(2/V);
% Frequency ranges:
f_pitch= 5:5:140; % Frequency [Cycle/s or Hz]
f_yaw= 5:5:140; % Frequency [Cycle/s or Hz]
divergence_map = [];
Rdivergence_map = [];
unstable = [];
% Modify the loop to iterate over frequency points
for i = 1:length(f_pitch)
for j = 1:length(f_yaw)
% Angular frequencies for the current frequency points
w_omega_pitch = 2 * pi * f_pitch(i);
w_omega_yaw = 2 * pi * f_yaw(j);
K_psi = (w_omega_pitch^2) * I_psioverI_b;
K_theta = (w_omega_yaw^2) * I_thetaoverI_b;
phi = 0;
% Define inertia matrix [M]
M_matrix = [I_thetaoverI_b + 1 + cos(2*phi), -sin(2*phi);
-sin(2*phi), I_psioverI_b + 1 - cos(2*phi)];
% Define damping matrix [D]
D11 = h^2*gamma*H_u*(1 - cos(2*phi)) - gamma*M_b*(1 + cos(2*phi)) - (2 + 2*h*gamma*M_u)*sin(2*phi);
D12 = h^2*gamma*H_u*sin(2*phi) + gamma*M_b*sin(2*phi) - 2*(1 + cos(2*phi)) - 2*h*gamma*M_u*cos(2*phi);
D21 = h^2*gamma*H_u*sin(2*phi) + gamma*M_b*sin(2*phi) + 2*(1 - cos(2*phi)) - 2*h*gamma*M_u*cos(2*phi);
D22 = h^2*gamma*H_u*(1 + cos(2*phi)) - gamma*M_b*(1 - cos(2*phi)) + (2 + 2*h*gamma*M_u)*sin(2*phi);
D_matrix = [D11, D12;
D21, D22];
% Define stiffness matrix [K]
K11 = K_theta - h*gamma*V*H_u*(1 - cos(2*phi)) + gamma*V*M_u*sin(2*phi);
K12 = -h*V*gamma*H_u*sin(2*phi) + gamma*V*M_u*(1 + cos(2*phi));
K21 = -h*gamma*V*H_u*sin(2*phi) - gamma*V*M_u*(1 - cos(2*phi));
K22 = K_psi - h*gamma*V*H_u*(1 + cos(2*phi)) - gamma*V*M_u*sin(2*phi);
K_matrix = [K11, K12;
K21, K22];
% a periodic matrix
A_top = [zeros(2, 2), eye(2)];
A_bottom = [-inv(M_matrix) * K_matrix, -inv(M_matrix) * D_matrix];
A = [A_top; A_bottom];
% Implement Floquet theory techniques to analyze stability
% Perform stability analysis using Floquet theory
eigenvalues = eig(A); % Compute eigenvalues of matrix A
T = 2*pi; % Period of the coefficients
F = expm(A*T); % Compute the monodromy matrix using Floquet theory
floquet_eigenvalues = eig(F); % Compute Floquet multipliers
A_new = A - [ 0, K_psi; K_theta, 0]; % Update A matrix
F_new = expm(A_new*T); % Compute new monodromy matrix
floquet_eigenvalues_new = eig(F_new); % Compute new Floquet multipliers
% Flutter
if max(real(eig(F_new)) > 0)
unstable = [unstable; phi, K_psi, K_theta];
end
% 1/Ω *(Divergence) proximity check
for ev = eig(F_new)
if (abs(ev) - freq_1_over_Omega) < 0.1
Rdivergence_map = [Rdivergence_map; phi, K_psi, K_theta];
end
end
% Divergence condition
if det(K_matrix) < 0
divergence_map = [divergence_map; phi, K_psi, K_theta];
end
end
end
% Plot the Flutter and divergence maps
figure;
hold on;
scatter(unstable(:,2), unstable(:,3), 'filled');
scatter(divergence_map(:,2), divergence_map(:,3), 'filled', 'r');
scatter(Rdivergence_map(:, 2), Rdivergence_map(:, 3), 'filled', 'g');
xlabel('K\_psi');
ylabel('K\_theta');
title('Whirl Flutter Diagram');
legend('Flutter area', 'Divergence area', ' 1/Ω Divergence area');
hold off;

请先登录,再进行评论。

回答(2 个)

Umar
Umar 2024-8-4
Hi @Nikko,
Please see attached plot regarding “ in which the code computes the Floquet multipliers by finding the eigenvalues of matrix F”

Umar
Umar 2024-8-5

Brief Analysis of troubleshooting your code

I had to do a lot of debugging in order to get your code executed properly. First, I had to deal with "Arrays have incompatible sizes for this operation" error, which was to make to sure that the arrays used in the calculations have compatible sizes. In the provided code, the issue arised from the calculation of the determinant of the K_matrix array. To resolve this issue, I had to modify the code to calculate the determinant of the K_matrix array using the det function. However, before calculating the determinant, I had to ensure that the K_matrix array is square, i.e., it has an equal number of rows and columns. So bear in mind , it is essential to ensure that the arrays used in calculations have compatible sizes. Before performing operations such as addition, subtraction, or multiplication, check that the arrays have the same dimensions or are compatible for the specific operation.Additionally, it is good practice to include error handling mechanisms, such as checking the size of arrays before performing operations, as shown in the solution above. This helps to catch any potential errors and handle them gracefully, providing informative messages to aid in debugging. Then, I faced with another error “index out of bounds error”, I added a check to verify that the arrays unstable, divergence_map, and Rdivergence_map have at least 3 columns before attempting to access elements at index 2 and 3. This precautionary measure helped me to prevent index out-of-bounds errors and ensures the arrays contain the necessary data for plotting. Afterwards, I faced the “Index in position 2 exceeds array bounds" error occurs when the code tries to access an element in an array that is beyond its bounds. In the given code, the error was caused by accessing elements in the unstable, divergence_map, and Rdivergence_map arrays without initializing them or updating their values. Lastly, removed the line scatter(Rdivergence_map(:, 2), Rdivergence_map(:, 3), 'filled', 'g'); since Rdivergence_map which was not used in the code. Here is your modified code,

N = 2; % Number of blades

I_thetaoverI_b = 2; % Moment of inertia pitch axis over I_b

I_psioverI_b = 2; % Moment of inertia yaw axis over I_b

C_thetaoverI_b = 0.00; % Damping coefficient over I_b

C_psioverI_b = 0.00; % Damping coefficient over I_b

h = 0.3; % rotor mast height, wing tip spar to rotor hub

hoverR = 0.34;

R = h / hoverR;

gamma = 4; % lock number

V_knots = 325; % the rotor forward velocity [knots]

% Convert velocity from [knots] to [meters per second]

% 1 knot = 0.51444 meters per second

V = V_knots * 0.51444;

% Calculate angular velocity in radians per second

omega_rad_s = V / R;

% Convert angular velocity from radians per second to RPM

% 1 radian per second = (60 / (2 * pi)) RPM

Omega = omega_rad_s * (60 / (2 * pi));

freq_1_over_Omega = 1 / Omega;

% the flap moment aerodynamic coefficients for large V

M_b = -(1 / 10) * V;

M_u = 1 / 6;

% the propeller aerodynamic coefficients

H_u = V / 2;

%%%%%%%%%%%the flap moment aerodynamic coefficients for small V

%M_b = -1*(1 + V^2)/8 ;

%M_u = V/4;

%the propeller aerodynamic coefficients

%H_u = (V^2/2)*log(2/V);

% Frequency ranges:

f_pitch = 5:5:140; % Frequency [Cycle/s or Hz]

f_yaw = 5:5:140; % Frequency [Cycle/s or Hz]

divergence_map = [];

unstable = [];

% Modify the loop to iterate over frequency points

for i = 1:length(f_pitch)

    for j = 1:length(f_yaw)
        % Angular frequencies for the current frequency points
        w_omega_pitch = 2 * pi * f_pitch(i);
        w_omega_yaw = 2 * pi * f_yaw(j);
        K_psi = (w_omega_pitch^2) * I_psioverI_b;
        K_theta = (w_omega_yaw^2) * I_thetaoverI_b;
        phi = 0;
        % Define inertia matrix [M]
        M_matrix = [I_thetaoverI_b + 1 + cos(2 * phi), -sin(2 * phi);
            -sin(2 * phi), I_psioverI_b + 1 - cos(2 * phi)];
        % Define damping matrix [D]

D11 = h^2 * gamma * H_u * (1 - cos(2 * phi)) - gamma * M_b * (1 + cos(2 * phi)) - (2 + 2 * h * gamma * M_u) * sin(2 * phi);

        D12 = h^2 * gamma * H_u * sin(2 * phi) + gamma * M_b * sin(2 * phi) - 2 * (1 + cos(2 * phi)) - 2 * h * gamma * M_u * cos(2 * phi);
        D21 = h^2 * gamma * H_u * sin(2 * phi) + gamma * M_b * sin(2 * phi) + 2 * (1 - cos(2 * phi)) - 2 * h * gamma * M_u * cos(2 * phi);
        D22 = h^2 * gamma * H_u * (1 + cos(2 * phi)) - gamma * M_b * (1 - cos(2 * phi)) + (2 + 2 * h * gamma * M_u) * sin(2 * phi);
        D_matrix = [D11, D12;
            D21, D22];
        % Define stiffness matrix [K]
        K11 = K_theta - h * gamma * V * H_u * (1 - cos(2 * phi)) + gamma * V * M_u * sin(2 * phi);
        K12 = -h * V * gamma * H_u * sin(2 * phi) + gamma * V * M_u * (1 + cos(2 * phi));
        K21 = -h * gamma * V * H_u * sin(2 * phi) - gamma * V * M_u * (1 - cos(2 * phi));
        K22 = K_psi - h * gamma * V * H_u * (1 + cos(2 * phi)) - gamma * V * M_u * sin(2 * phi);
        K_matrix = [K11, K12;
            K21, K22];
        % Check if K_matrix is square
        if size(K_matrix, 1) == size(K_matrix, 2)
            % Calculate determinant of K_matrix
            det_K = det(K_matrix);
            % Divergence condition
            if det_K < 0
                divergence_map = [divergence_map; phi, K_psi, K_theta];
            else
                unstable = [unstable; phi, K_psi, K_theta];
            end
        else
            disp('K_matrix is not square');
        end
    end

end

% Plot the Flutter and divergence maps

figure;

hold on;

scatter(unstable(:, 2), unstable(:, 3), 'filled');

scatter(divergence_map(:, 2), divergence_map(:, 3), 'filled', 'r');

xlabel('K\_psi');

ylabel('K\_theta');

title('Whirl Flutter Diagram');

legend('Flutter area', 'Divergence area');

hold off;

Please execute the modified code to see your attached plot.

I spent enough time troubleshooting this code, so for the future reference, I will advise, try to implement small lines of code first, display results to make sure that you are satisfied with them, it’s like solving a puzzle by putting small pieces together to get the bigger picture. Also, I do admire your enthusiasm solving a complex problem. You are quite motivated and this is why I started helping you out in your previous posts to help achieve your goal and didn’t want you to give up on it that you worked so hard for.

  12 个评论
dpb
dpb 2024-8-10
"... not likely you'll find a better set of methods for matrix calculations than those implemented in MATLAB. Real pros built these..."
To get an idea of the sort of folks and on what MATLAB is based, you can look at a couple of Cleve's blog posts; these just scratch the surface, but give an idea of the sophistication of the underpinnings...
<Brief MATLAB History> and <The Gatlinburg and Householder Symposia>. Poking at <Cleve's Corner> is extremely educational although can be a deep diversion from what one's supposed to be doing! <vbg>
The ACM SIG on Programming Languages planned on a 2020 conference on the History of Programming Languages and Cleve wrote a paper on MATLAB for it which he posted piecewise as he completed sections...at some time in the distant past I collected the sequence of post links as follows...
Umar
Umar 2024-8-10
Hi @dpb,
Your insights are invaluable, and I am grateful for your guidance in navigating this complex subject. Should you have any further recommendations or discussions in mind, please feel free to share.It’s like The "rinse and repeat" instruction on shampoo bottle as you mentioned before. Still cracks me up.🤣

请先登录,再进行评论。

类别

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

产品

Community Treasure Hunt

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

Start Hunting!

Translated by