Give me images of the code bellow
* Item one
* Item twoclc; clear; close all;
% Given Parameters
M = 1000; % Mass (kg)
K = 36000; % Column stiffness (N/m)
C = 600; % Damping coefficient (Ns/m)
Ks = 10000; % Soil stiffness (N/m)
wn = 6; % Natural frequency (rad/sec)
tspan = [0 10]; % Time span for simulation
% LuGre friction model parameters
mu_s = 0.2; % Static friction coefficient
mu_c = 0.1; % Dynamic friction coefficient
vs = 0.1; % Stribeck velocity
sigma0 = 1000; % Stiffness coefficient of bristle deflection
sigma1 = 10; % Damping coefficient
sigma2 = 0; % Viscous damping (optional)
% Load Seismic Data (Modify to load your earthquake data)
load(‘seismic_data.mat’);
acc_eq = acc_eq * 9.81; % Convert to m/s² if needed
% Interpolate to match time step
t_interp = linspace(min(t_eq), max(t_eq), length(tspan));
acc_interp = interp1(t_eq, acc_eq, t_interp, ‘linear’);
% Define ODE function with seismic input
function dxdt = SDOF_LuGre_Seismic(t, x, M, C, K, Ks, acc_interp, t_interp, mu_s, mu_c, vs, sigma0, sigma1, sigma2)
y = x(1);
y_dot = x(2);
z = x(3);
acc_g = interp1(t_interp, acc_interp, t, ‘linear’, 0);
g_y = mu_c + (mu_s – mu_c) * exp(-(y_dot / vs)^2);
z_dot = y_dot – (abs(y_dot) / g_y) * z;
F_friction = sigma0 * z + sigma1 * z_dot + sigma2 * y_dot;
y_ddot = (-C/M) * y_dot – (K/M) * y + (Ks/M) * acc_g – (F_friction/M);
dxdt = [y_dot; y_ddot; z_dot];
end
% Initial conditions
y0 = [0; 0; 0];
% Solve using ODE45
[t, Y] = ode45(@(t, x) SDOF_LuGre_Seismic(t, x, M, C, K, Ks, acc_interp, t_interp, mu_s, mu_c, vs, sigma0, sigma1, sigma2), tspan, y0);
% Extract displacement and velocity
y_response = Y(:, 1);
y_velocity = Y(:, 2);
% FFT Analysis
Fs = 100;
L = length(y_response);
Y_fft = fft(y_response);
P2 = abs(Y_fft/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs * (0:(L/2)) / L;
% Plot and Save Waveform
figure;
plot(t, y_response, ‘b’, ‘LineWidth’, 1.5);
xlabel(‘Time (s)’); ylabel(‘Displacement (m)’);
title(‘Displacement Response under Seismic Excitation’);
grid on;
saveas(gcf, ‘displacement_waveform.png’);
% Plot and Save Phase Plot
figure;
plot(y_response, y_velocity, ‘r’, ‘LineWidth’, 1.5);
xlabel(‘Displacement (m)’); ylabel(‘Velocity (m/s)’);
title(‘Phase Plot: Velocity vs. Displacement’);
grid on;
saveas(gcf, ‘phase_plot.png’);
% Plot and Save FFT Analysis
figure;
plot(f, P1, ‘g’, ‘LineWidth’, 1.5);
xlabel(‘Frequency (Hz)’); ylabel(‘Magnitude’);
title(‘FFT Analysis of Displacement Response’);
grid on;
saveas(gcf, ‘fft_analysis.png’);
% Display maximum displacement
disp([‘Maximum Displacement: ‘, num2str(max(abs(y_response))), ‘ m’]);* Item one
* Item twoclc; clear; close all;
% Given Parameters
M = 1000; % Mass (kg)
K = 36000; % Column stiffness (N/m)
C = 600; % Damping coefficient (Ns/m)
Ks = 10000; % Soil stiffness (N/m)
wn = 6; % Natural frequency (rad/sec)
tspan = [0 10]; % Time span for simulation
% LuGre friction model parameters
mu_s = 0.2; % Static friction coefficient
mu_c = 0.1; % Dynamic friction coefficient
vs = 0.1; % Stribeck velocity
sigma0 = 1000; % Stiffness coefficient of bristle deflection
sigma1 = 10; % Damping coefficient
sigma2 = 0; % Viscous damping (optional)
% Load Seismic Data (Modify to load your earthquake data)
load(‘seismic_data.mat’);
acc_eq = acc_eq * 9.81; % Convert to m/s² if needed
% Interpolate to match time step
t_interp = linspace(min(t_eq), max(t_eq), length(tspan));
acc_interp = interp1(t_eq, acc_eq, t_interp, ‘linear’);
% Define ODE function with seismic input
function dxdt = SDOF_LuGre_Seismic(t, x, M, C, K, Ks, acc_interp, t_interp, mu_s, mu_c, vs, sigma0, sigma1, sigma2)
y = x(1);
y_dot = x(2);
z = x(3);
acc_g = interp1(t_interp, acc_interp, t, ‘linear’, 0);
g_y = mu_c + (mu_s – mu_c) * exp(-(y_dot / vs)^2);
z_dot = y_dot – (abs(y_dot) / g_y) * z;
F_friction = sigma0 * z + sigma1 * z_dot + sigma2 * y_dot;
y_ddot = (-C/M) * y_dot – (K/M) * y + (Ks/M) * acc_g – (F_friction/M);
dxdt = [y_dot; y_ddot; z_dot];
end
% Initial conditions
y0 = [0; 0; 0];
% Solve using ODE45
[t, Y] = ode45(@(t, x) SDOF_LuGre_Seismic(t, x, M, C, K, Ks, acc_interp, t_interp, mu_s, mu_c, vs, sigma0, sigma1, sigma2), tspan, y0);
% Extract displacement and velocity
y_response = Y(:, 1);
y_velocity = Y(:, 2);
% FFT Analysis
Fs = 100;
L = length(y_response);
Y_fft = fft(y_response);
P2 = abs(Y_fft/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs * (0:(L/2)) / L;
% Plot and Save Waveform
figure;
plot(t, y_response, ‘b’, ‘LineWidth’, 1.5);
xlabel(‘Time (s)’); ylabel(‘Displacement (m)’);
title(‘Displacement Response under Seismic Excitation’);
grid on;
saveas(gcf, ‘displacement_waveform.png’);
% Plot and Save Phase Plot
figure;
plot(y_response, y_velocity, ‘r’, ‘LineWidth’, 1.5);
xlabel(‘Displacement (m)’); ylabel(‘Velocity (m/s)’);
title(‘Phase Plot: Velocity vs. Displacement’);
grid on;
saveas(gcf, ‘phase_plot.png’);
% Plot and Save FFT Analysis
figure;
plot(f, P1, ‘g’, ‘LineWidth’, 1.5);
xlabel(‘Frequency (Hz)’); ylabel(‘Magnitude’);
title(‘FFT Analysis of Displacement Response’);
grid on;
saveas(gcf, ‘fft_analysis.png’);
% Display maximum displacement
disp([‘Maximum Displacement: ‘, num2str(max(abs(y_response))), ‘ m’]); * Item one
* Item twoclc; clear; close all;
% Given Parameters
M = 1000; % Mass (kg)
K = 36000; % Column stiffness (N/m)
C = 600; % Damping coefficient (Ns/m)
Ks = 10000; % Soil stiffness (N/m)
wn = 6; % Natural frequency (rad/sec)
tspan = [0 10]; % Time span for simulation
% LuGre friction model parameters
mu_s = 0.2; % Static friction coefficient
mu_c = 0.1; % Dynamic friction coefficient
vs = 0.1; % Stribeck velocity
sigma0 = 1000; % Stiffness coefficient of bristle deflection
sigma1 = 10; % Damping coefficient
sigma2 = 0; % Viscous damping (optional)
% Load Seismic Data (Modify to load your earthquake data)
load(‘seismic_data.mat’);
acc_eq = acc_eq * 9.81; % Convert to m/s² if needed
% Interpolate to match time step
t_interp = linspace(min(t_eq), max(t_eq), length(tspan));
acc_interp = interp1(t_eq, acc_eq, t_interp, ‘linear’);
% Define ODE function with seismic input
function dxdt = SDOF_LuGre_Seismic(t, x, M, C, K, Ks, acc_interp, t_interp, mu_s, mu_c, vs, sigma0, sigma1, sigma2)
y = x(1);
y_dot = x(2);
z = x(3);
acc_g = interp1(t_interp, acc_interp, t, ‘linear’, 0);
g_y = mu_c + (mu_s – mu_c) * exp(-(y_dot / vs)^2);
z_dot = y_dot – (abs(y_dot) / g_y) * z;
F_friction = sigma0 * z + sigma1 * z_dot + sigma2 * y_dot;
y_ddot = (-C/M) * y_dot – (K/M) * y + (Ks/M) * acc_g – (F_friction/M);
dxdt = [y_dot; y_ddot; z_dot];
end
% Initial conditions
y0 = [0; 0; 0];
% Solve using ODE45
[t, Y] = ode45(@(t, x) SDOF_LuGre_Seismic(t, x, M, C, K, Ks, acc_interp, t_interp, mu_s, mu_c, vs, sigma0, sigma1, sigma2), tspan, y0);
% Extract displacement and velocity
y_response = Y(:, 1);
y_velocity = Y(:, 2);
% FFT Analysis
Fs = 100;
L = length(y_response);
Y_fft = fft(y_response);
P2 = abs(Y_fft/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs * (0:(L/2)) / L;
% Plot and Save Waveform
figure;
plot(t, y_response, ‘b’, ‘LineWidth’, 1.5);
xlabel(‘Time (s)’); ylabel(‘Displacement (m)’);
title(‘Displacement Response under Seismic Excitation’);
grid on;
saveas(gcf, ‘displacement_waveform.png’);
% Plot and Save Phase Plot
figure;
plot(y_response, y_velocity, ‘r’, ‘LineWidth’, 1.5);
xlabel(‘Displacement (m)’); ylabel(‘Velocity (m/s)’);
title(‘Phase Plot: Velocity vs. Displacement’);
grid on;
saveas(gcf, ‘phase_plot.png’);
% Plot and Save FFT Analysis
figure;
plot(f, P1, ‘g’, ‘LineWidth’, 1.5);
xlabel(‘Frequency (Hz)’); ylabel(‘Magnitude’);
title(‘FFT Analysis of Displacement Response’);
grid on;
saveas(gcf, ‘fft_analysis.png’);
% Display maximum displacement
disp([‘Maximum Displacement: ‘, num2str(max(abs(y_response))), ‘ m’]); image processing MATLAB Answers — New Questions