Hey SKRE,
Creating a simulation in Simulink using point-wise transfer function data can indeed be challenging but is certainly doable. Here are some steps and considerations that might help you achieve your goal.
- Prepare Data:Organize your frequencies, amplitudes, and phase shifts.
- Create Interpolation Functions in MATLAB:
amp_interp = @(f) interp1(freq, amplitude, f, 'linear');
phase_interp = @(f) interp1(freq, phase, f, 'linear');
- Implement MATLAB Function Block in Simulink: Add a MATLAB Function block with the following code
function y = pointwise_transfer_function(u, freq)
% Define interpolation functions
amp_interp = @(f) interp1(freq, amplitude, f, 'linear');
phase_interp = @(f) interp1(freq, phase, f, 'linear');
% Interpolate amplitude and phase
amplitude = amp_interp(freq);
phase_shift = phase_interp(freq);
% Apply transfer function
y = amplitude * u * exp(1i * phase_shift);
end
- Connect Blocks:Connect your input signal to the MATLAB Function block.
- Connect the output to a Scope for visualization.
- Test and Validate.
Hope it helps.