insert an array of values inside a transfer function block(simulink)

6 次查看(过去 30 天)
I have tau=0.1:0.1:10;
this array of tau values must be simulated for an ODE(xdotdot+tau*xdot+x=u) using a transfer function(simulink) block to find ideal value of tau.
denominator of transfer function is [1 tau*s 1]
I am unable add array of values,to make simulate multiple values in simulink .

回答(1 个)

Riya
Riya 2023-11-19
Hello mohamed sarfaras JAFARULLA KHAN,
As per my understanding you want to insert an array of values inside a transfer function block in Simulink.
Please note that to simulate multiple values of tau in Simulink using a transfer function block, you can follow these steps:
1. Create a MATLAB Function block in Simulink. This block will allow you to define and use MATLAB code within your Simulink model.
2. Inside the MATLAB Function block, define the array of tau values using the given expression: `tau = 0.1:0.1:10;`.
3. Use a for loop to iterate over the tau values and simulate the system for each value. Within the loop, create a transfer function object using the `tf` function and specify the numerator and denominator coefficients.
Here is an example of how the MATLAB Function block code could look like:
function y = tauSimulation(u)
tau = 0.1:0.1:10;
y = zeros(size(tau));
for i = 1:length(tau)
sys = tf(1, [1, tau(i), 1]);
y(i) = lsim(sys, u);
end
end
4. Connect the input `u` to the MATLAB Function block and use the output `y` to observe the simulated response for each tau value.
By implementing this MATLAB Function block in your Simulink model, you will be able to simulate the system for multiple values of tau using the transfer function block.
I hope it helps.
Regards
Riya

类别

Help CenterFile Exchange 中查找有关 Event Functions 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by