How do I subtract a bunch of data created in MATLAB from another source in Simulink?

1 次查看(过去 30 天)
So, I have a simulink model with sine source input created from a time vector 't'. I now have to create a cosine source and should send it for simulation. I have done this step. But now in simulink, I have to subtract the data that was created in MATLAB from the cosine source input in Simulink. Can anyone help me with this.

回答(1 个)

Prajit T R
Prajit T R 2018-2-22
Hi Aishwarya
Your query was regarding subtraction of data in MATLAB workspace and a block in the Simulink environment. There are multiple ways to do this.
An easy method would be to use the block titled 'from workspace' in which you can mention the variable's name, sample time etc. The output from this block (which is present under Simulink -> Sources) can be used in tandem with the cosine source and subtraction would be possible.
Another method would be to navigate to Model Configuration Paramaters -> Data import/export and then tick the option for input and keep its value as [t,u]. (Replace u by your variable's name) Then you need to use an In1 block which is present under Simulink -> Sources to obtain the data from workspace.
Either ways, you would be able to subtract the two signals.

类别

Help CenterFile Exchange 中查找有关 Prepare Model Inputs and Outputs 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by