simulink

How can I get signal dimensions in Simulink model

风格不统一 提交于 2019-12-09 01:02:15
问题 I have a question. After simulate a simulink model I need to get signal dimensions of each line using MATLAB command. I get line handles by following line_h = find_system(gcs, 'FindAll', 'on','SearchDepth', 1, 'Type', 'Line') then how can I get signal dimensions from line handles ** When check 'signal dimensions' in Format menu -> Port/Signal Displays After simulate a model number of signal dimensions will show on nonscalar line. I need to get it using MATLAB command. Sorry for my English

【MATLAB】simulink中FDATool设计离散滤波器

本秂侑毒 提交于 2019-12-08 09:12:35
FDATool界面简介 1 FDATool的介绍 FDATool(Filter Design&Analysis Tool)是MATLAB信号处理工具箱里专用的滤波器设计分析工具,MATLAB 6.0以上的版本还专门增加了滤波器设计工具箱(Filter Design Toolbox)。FDATool可以设计几乎所有的常规滤波器,包括FIR和IIR的各种设计方法。它操作简单,方便灵活。 FDATool界面总共分两大部分,一部分是Design Filter。在界面的下半部,用来设置滤波器的设计参数;另一部分则是特性区,在界面的上半部分,用来显示滤波器的各种特性。Design Filter部分主要分为:Filter Type(滤波器类型)选项,包括Lowpass(低通)、Highpass(高通)、Bandpass(带通)、Bandstop(带阻)和特殊的FIR滤波器。 Design Method(设计方法)选项 ,包括IIR滤波器的Butterwotth(巴特沃思)法、Chebyshev Type I(切比雪夫I型)法、Chebyshev Type II(切比雪夫II型)法、Elliptic(椭圆滤波器)法和FIR滤波器的Equiripple法、Least-Squares(最小乘方)法、Window(窗函数)法。 注:数字滤波器从实现的网络结构或者从单位脉冲响应分类,可以分成无限脉冲响应

Increment a variable by Simulink

落花浮王杯 提交于 2019-12-08 07:22:36
问题 I have a problem in Simulink, I have a variable "k" as constant Block (start Value k =1 ) and i want to increment "k" after each time I click on "the simulation button" untill "k" is 4 then it will be reset to 1 again. i already try this (see atached Image 1), but in this case k it wil be so long inkremented until the Simulation time is finished (see atached Image 2) and that is not what i want. enter image description here enter image description here i will apreciate any Help many thanks

How to smooth rectangular signal with high order rate-limiter in Simulink?

吃可爱长大的小学妹 提交于 2019-12-08 06:33:48
问题 Imagine I have a rectangular reference value for the position/displacement x and I need to smooth it. The math for translatoric movements is quite simple: speed: v = x' acceleration: a = v' = x'' jerk. j = a' = v'' = x''' I need to limit all these values. So I thought about using rate limiters in Simulink: This approach works perfect for ramp signals, as you can see in the following output: BUT, my reference signals for x are no ramps, they are rectangles/steps. Hence the rate limiters are

switch-case with multiple matches in matlab for code generation

霸气de小男生 提交于 2019-12-07 17:20:37
问题 The following code is valid matlab sytax to check whether b matches any elements in a . However, if the code is used for code generation (i.e. simulink) then I get the error: 'code generation only supports cell operations for varargin and varargout You can check this by adding %#codegen at the top of the script.) a={2 3}; b=3; switch b case a disp yay otherwise disp boo end What should I do to match multiple patterns in a case statement in code-generation compatible code? The following don't

How to share a C struct among C S-functions?

前提是你 提交于 2019-12-07 13:31:42
问题 Is there a way to share a C structure (instantiated only once) among several C S-functions? Here's what I mean: I have a Simulink model with many blocks that are implemented as C S-functions. There are many model parameters that are needed in those blocks and I would like to create a single object that holds all model parameters and is instantiated only once when I start the simulation. Right now I instantiate this object for each S-function in order to access the parameters but it would be

Access/Call Simulink from Python

六眼飞鱼酱① 提交于 2019-12-07 09:38:04
问题 I want to model a system in Simulink, and then access that simulation from a python program to feed it new conditions or inputs. I know there is a module out there that allows you to access the Matlab engine from Python, but this is a little different. I'd like to have a system modeled in Simulink, and monitor some hardware using Python. Then, every say quarter second or so, call Simulink, run the simulation using current conditions of the hardware, get some output and repeat the process.

Co-Simulation with Simulink: stepwise execution and interchange of parameters with external application

烈酒焚心 提交于 2019-12-06 13:48:52
问题 I have to realise a coupled simulation with Simulink and an external application (LS-DYNA). The leading simulation is done in Simulink, where I want to implement a function block as following: The interaction is done using the cmd of windows, so the Simulink block should do the following: function [ x,y ] = ExternalSimlation( u,v ) % open the windows cmd and run the external simulation by passing u and v [status,cmdout] = system( 'command for executing the external simulation -u -v');

How to get the content of an embedded MATLAB function

爷,独闯天下 提交于 2019-12-06 13:36:24
In my Simulink model are some embedded MATLAB functions. Is there a way to get the content (the text you see in the editor) of this blocks? My first guess was to use find_system to get the embedded MATLAB functions and then get_param to get the content. But I dont find the needed parameter name. The documentation didnt show up any parameter for the embedded MATLAB functions. Try this technical solution on the Mathworks website. 来源: https://stackoverflow.com/questions/3248924/how-to-get-the-content-of-an-embedded-matlab-function

Editing the Code of a “MATLAB Function” Block in Simulink Programmatically

与世无争的帅哥 提交于 2019-12-06 09:46:19
I'd like to create a simple Simulink model containing a "MATLAB Function" block programmatically -- i.e. using Matlab code. Thanks to this guide , I've managed to create a new model containing the block: open_system(new_system('my_system')) add_block('simulink/User-Defined Functions/MATLAB Function', 'my_system/my_func') Usually, in order to edit the "MATLAB Function" block's code, one has to "open" the block by double-clicking on it then entering the new code. However, I would like to set that code programmatically using e.g. set_param() or any relevant function. For instance, to set the