Hellow everyone, I am currently doing a project which includes simulating a quarter car model on a random road profile based on ISO 8608. I have coded the road profile in matlab and wanted to input the profile which is a 1 x 2250 data as an input for my quarter car model, but the simulink model includes a derivative and integration blocks so I guess it is why I'm always receiving an error message everytime it runs. Is there anyway I could do this, what I want to do basically is replace the usual sine wave or step function with the data I have generated with matlab.
Thank you in advance, below are my simulink model and matlab code
k = 4;
V = 40;
L = 250;
N = L / (V / 3.6) * 100;
B = L / N;
dn = 1 / L;
n0 = 0.1;
n = dn : dn : N * dn;
phi = 2 * pi * rand(size(n));
Amp1 = sqrt(dn) * (2^k) * (1e-3) * (n0 ./ n);
x = 0 : B : L - B;
t = x ./ (V / 3.6);
hx = zeros(size(x));
for i = 1:length(x)
hx(i) = sum(Amp1 .* cos((2 * pi * n * x(i)) + phi));
end
[q , C] = psd_1D(hx, B, 'x');
lambda = (2*pi) ./ q;
f = q / (2*pi);
PSD = 2 * pi * C;
log_f = log10(f);
log_psd = log10(PSD);
subplot(2,2,1)
plot(x, hx);
xlabel('Distance (m)');
ylabel('Amplitude (m)');
grid on
subplot(2,2,2)
plot(log_f, log_psd);
xlabel('Frequency (cycles/m)');
ylabel('PSD (m^3)');
grid on
subplot(2,2,3)
plot(t, hx);
xlabel('Time (s)');
ylabel('Amplitude (m)');
grid on