f



How can I use a Matlab function, whose inputs varies with time (real time function), in simulink

Hello 
I need your help
I would llike to know how can I use a Matlab function, whose inputs varies with time (real time function), in simulink.
Thank you in advance 
Hiba
0
Hiba
11/30/2010 10:36:04 AM
comp.soft-sys.matlab 211265 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

0 Replies
1880 Views

Similar Articles

[PageSpeed] 3

Reply:

Similar Artilces:

For Real-Time Workshop use Embedded Matlab Function block
Hi, everyone When I use Embedded Matlab Function block under Real-Time Workshop, it shows the following error: Failed to eliminate a use of the MATLAB function 'videoinput'. For non-simulation builds, uses of unsupported MATLAB functions are eliminated if they do not effect the model outputs. But I have declared the "videoinput" function, using eml.extrinsic ('videoinput'). After I see the matlab help, it says: For Real-Time Workshop and custom targets, Embedded MATLAB attempts to determine whether the extrinsic function affects the output of the Embedded MATLAB ...

MATLAB discrete time simulation of simulink model (Control simulink simulation time from MATLAB)
I am trying to run a simulink model simulation in definite time steps from MATLAB so that I can extract data from simulink, do some caluclations and send these new data back to Simulink for further simulation from the point I left off. The process can be descirbed below: Note that total simulation time is 600 seconds. 1. Start simulation from MATLAB for 100 seconds and then pause the simulation 2. Extract all the data I need from simulink and bring into MATLAB, do some calculations to changes simulink model parameters and then pass this new calculated data back to simulink. 3. Continue the simulation where I left off (i.e. from 100 seconds) but this time in 15 second intervals, up to total simulation time end (repeating step 2 and 3 after every 15 seconds). Can someone please advise if they have done this before and what command structures they used. Thank you. True. You can "sim" to achieve this. Try "help sim" to learn details. Yi "High Voltage" <e8342lec@yahoo.com> wrote in message <gt61tq$657$1@fred.mathworks.com>... > I am trying to run a simulink model simulation in definite time steps from MATLAB so that I can extract data from simulink, do some caluclations and send these new data back to Simulink for further simulation from the point I left off. > > The process can be descirbed below: > > Note that total simulation time is 600 seconds. > > 1. Start simulation from MATLAB for 100 seconds and...

generate function in matlab to use as input in simulink
i have created a function in matlab which i need to use as an input to my model in simulink. how do i save this function to a .mat file so i can use it in the From File block? here is the function g = inline('20.*(0<t).*(t<5)+(40*t-20).*(0.5<t).*(t<1)+(20+20* sin(2*pi*t)).*(1<=t).*(t<3)+20.*(3<=t).*(t<5)+(40*t-140).* (3.5<=t).*(t<4)+ 20.*(4<=t).*(t<5)+(-80*t+360) .* (4.5<t).*(t<5)','t'); hi does t imply the simulation time of simulink model then why dont u make the same expression in a stateflow objet and pass the output to simulink...

re-numbering the time axis after the use of"conv" function in Matlab
Well, as is obvious to anyone, matlab assigns numbering from n=1 to any vector as opposed to n=0 in the signal processing textbooks...so, what the big deal!! well, it can influence the results of certain operations such as convolution by an offset...here's an example consider a seq x(n)...convolve it by a causal impulse response, h(n)=delta(n-100) where delta is kronecker delta... this should simply delay x(n) by 100 samples..!! But if you were to do this simple computation in Matlab, it will produce an output which is delayed by 99 samples and not 100.... REASON: Any "text book&qu...

How to write a C wrapper dll to export Matlab dll functions so that LabVIEW Call Library Function Node can use it?
Hello LabView developers, &nbsp; I used LabVIEW to call Matlab m script to implement matlab MPC successfully. I wanted to use Matlab compiler to compile the matlab m script function into a c&nbsp;shared library&nbsp;.dll so that LabVIEW can call it without requiring Matlab installed on the PC. &nbsp; I used MatLab R2007b with matlab compiler. I was able to generate a C shared library dll set successfully using mcc command. &nbsp; However, from the header file, I see that the inputs and outputs of&nbsp;the function prototype&nbsp;are&nbsp;in mxArray. I need to change this data type to whatever that&nbsp;LabView Call&nbsp;Library Function Node can recognize. &nbsp; I have followed a few examples in the forum, but none of them went through. &nbsp; I use LabView 8.5. I have Microsoft Visual C++ Version 6 and Microsoft Visual Studio 2005. The compiler is in C++. Should I use a C compiler only to generate the C wrapper dll so that Labview can recognize it in the Call Library Function Node? &nbsp; If anybody has gone through this successfully, I would like to learn from you on how to do it. &nbsp; Thanks, &nbsp; Kimberly yw wrote: Hello LabView developers, &nbsp; I used LabVIEW to call Matlab m script to implement matlab MPC successfully. I wanted to use Matlab compiler to compile the matlab m script function into a c&nbsp;shared library&nbsp;.dll so that LabVIEW can call it without requiring Matlab installed ...

Calling Functions in an Embedded Matlab Function in Simulink
I have created a Simulink model to test a Kalman filter that I designed and to replicate real data input, I am using an embedded Matlab file that calls a function within this file called "myWait". I placed this function at the end of my embedded Matlab file and it does not seem to have any problems calling this function, but within this function, it makes use of predefined functions "timer", "start" and "wait". When I try to build the model I get the following errors: Undefined function or variable 'start'. Function 'Real Time States' (#127.903.911), line 34, column 5: "start(t)" Undefined function or variable 'wait'. Function 'Real Time States' (#127.917.924), line 35, column 5: "wait(t)" Function call failed. Function 'Real Time States' (#127.494.512), line 14, column 5: "myWait(GPS_Period)" Undefined function or variable 'start'. Function 'Real Time States' (#127.903.911), line 34, column 5: "start(t)" Undefined function or variable 'wait'. Function 'Real Time States' (#127.917.924), line 35, column 5: "wait(t)" Function call failed. Function 'Real Time States' (#127.608.626), line 20, column 5: "myWait(IMU_Period)" Errors occurred during parsing of Embedded MATLAB function 'Real Time States'(#127) Function 'timer' implicitly resolved in the MATLAB workspac...

Using the GINPUT function in compiled matlab function
Hi all I have a stand alone matlab function that working with a.net window form. The matlab function gets from the .net data and plots it in the matlab figure. After call to the matlab compiled function I will have two open windows: 1) matlab figure with the plotted data 2) the .net form window My problem occurs when I�m trying to use the GINPUT matlab function. When I�m calling to the GINPUT method and press on the .NET Form before select any points on the graph then I can�t go back to the matlab figure(I get a busy mouse even the matlab figure became the active window), I think this proble...

Matlab to Simulink in real time
I'm trying to use Matlab workspace data as input for Simulink instead of a joystick or mouse. Admittedly, I'm pretty inexperienced with both programs, so I can't figure out how to do this. The "From Workspace" block only takes data from the Matlab workspace at the start of the Simulink model. How can I constantly send data from Matlab to Simulink throughout the simulation? Thanks ahead of time. "James Yamada" <jamesyamada@gmail.com> wrote in message <go990h$2ba$1@fred.mathworks.com>... > I'm trying to use Matlab workspace data as input for Si...

Simulink - Embedded Matlab function
Hi all, I am trying to use an embedded Matlab function block to calculate a time delay such as: x(t) - x(t - tn) = constant My code is below where 'x' and 't' are input vectors of 21x1 (created using the 'Tapped Delay' block) and I require 'tn' as a scalar output. %%%%%%%%%%%%%%%%%%%%%%%%%%% function tn = fcn(x, t) %#codegen tn = zeros(1, 'double'); %#ok<*PREALL> if x(end) < 1 tn = 1.1; return end coder.extrinsic('csapi', 'fnval') coder.varsize('tn', 1) tq = min(t):0.001:max(t); b = csapi(...

Compiling Matlab Function with mcc to use in other versions of Matlab
I am new to using mcc, mbuild, and mex - I'm attempting to use these to compile a function in matlab into a dll or exe so that I can re-use it in Matlab just as if it was still an m file. First, I wanted to verify that the code works, and I have received a demo license of the Matlab Compiler to test. As a simple example I've written the following function: function [output_var] = this_is_a_test(input_var) output_var = input_var*2; return I've tried multiple combinations of the mcc call in attempts to compile this function, some compile, some don't. First I tried this call: m...

howto use mex to compile S-functions to use with Real-Time Windows Target
Hi all, In the previous versions of matlab (6p1 and 6p5) I was able to insert my own s-functions using the mex utility.. (generating a .dll file and using it directly in the real time simulation and access hardware). But the in matlab7 rtwin uses openwatcom compiler which is not supported by the mex utility.. (when you try to setup mex using mex -setup, openwatcom compiler is not included in the supported compilers list) Can I use the sfunctions compiled with lcc or microsoft visual c.net with the new rtwin? is there a way to use openwat with mex utility? how about the sfunctions that access...

How to use Embedded Matlab Function in Simulink
Hello, everyone I&#8217;m trying to make triangle waveform and then want to use it in simulink. I downloaded the function of triangle waveform and use it in &#8216;Embedded Matlab function&#8217; like it below. ************************************************************ function y = tri(ts,fsc) % This block supports an embeddable subset of the MATLAB language. % See the help menu for details. N = 2^14; % N = 16384 y = zeros(1,N+1); y = trianglewave(ts,fsc); % ts = 1/fs, fs = 1.408e6, % fsc = 400e3 ****************************************...

can Simulink and matlab run at the same time?
i simulate 5dof manipulator in simulink,but in simulink, i can't show the trajectory of the end-effector when simulation...i can show it in matlab,but i don't know how to simulink and matlab run at the same time so that the action of manipulator and the trajectory of end effector synchronize... help me please!!! many thanks in advance!!!!! El mi=E9rcoles, 8 de junio de 2011 14:12:02 UTC-3, kha quach escribi=F3: > i simulate 5dof manipulator in simulink,but in simulink, i can't show the= trajectory of the end-effector when simulation...i can show it in matlab,b= ut i don...

Simulink - Embedded Matlab Function
Hey all, I'm trying to convert a .m file into something usable by a user defined function block in simulink but am having trouble with the following style of equation: x = exp([-y:y]); where y is an integer which normally has a value between 40 and 120. Running this through simulink results in the following error: ------------------------------------------------ Computed maximum size of the output of function 'colon' is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?]. Function 'testing.m' line 8, column 14: "...

Can signalbuilder use subsystem time instead of simulink time?
Hi, i want to use the signal builder in an 'trigger and enable' subsystem so that when the subsystem is triggered, the signal builder starts to work. However, i find that the signal builder uses the simulink time not the subsystem time, which means if i define a pulse at t=5s in the signal builder interface, this pulse only happens when the simulink time is at 5s, not 5s after the subsystem is triggered. So is there anyway to make the time of the signal builder start only when the subsystem is triggered? Thanks. ...

help using embedded matlab function in Simulink
Hello, i have the following problem: I'm trying to use the "from audio device" and "to audio device" blocks in simulink, and i would like to use a matlab function to process the signal from the audio device and then send it to the output. The problem is that when I do it i get an error for the "to audio device" block that says "invalid sample rate". I also tried to define a sample rate for input and output through the properties of each block but it didn't help. Any help would be appreciated. ...

Real time control system using matlab
I tried to develop real time closed loop control system with the help of PI controller using real time windows target tool box in matlab.I am analysed below listed things.... 1.Real time control system made with out network then ,the design specification of control system is satisfied . 2..Real time control system made with half way network within the local host itself then ,the design specification of control system is varied system is stable. 3.Real time control system made with two way network within the local host itself then ,the design specification of control system is varied ...

How to use Embedded Matlab Function in Simulink #2
Hello, everyone I&#8217;m trying to make triangle waveform and then want to use it in simulink. I downloaded the function of triangle waveform and use it in &#8216;Embedded Matlab function&#8217; like it below. ************************************************************ ******* function y = tri(ts,fsc) % This block supports an embeddable subset of the MATLAB language. % See the help menu for details. N = 2^14; % N = 16384 y = zeros(1,N+1); y = trianglewave(ts,fsc); % ts = 1/fs, fs = 1.408e6, %fsc = 400e3 **************************************...

can Simulink and matlab run at the same time? #2
i simulate 5dof manipulator in simulink,but in simulink, i can't show the trajectory of the end-effector when simulation...i can show it in matlab,but i don't know how to simulink and matlab run at the same time so that the action of manipulator and the trajectory of end effector synchronize... help me please!!! many thanks in advance!!!!! ...

can Simulink and matlab run at the same time? #3
i simulate 5dof manipulator in simulink,but in simulink, i can't show the trajectory of the end-effector when simulation...i can show it in matlab,but i don't know how to simulink and matlab run at the same time so that the action of manipulator and the trajectory of end effector synchronize... help me please!!! many thanks in advance!!!!! ...

How can I convert a matlab function to C/C++ callable dll function ?
Dear Community Members I'd like to convert my .m file function to a C/C++ callable dll function. How can I convert an m file function to a C/C++ callable dll function and How can I call and parse it inside a C/C++ function ? Yours Faithfully Cem DEMiRKIR ...

How to use new functions of new Matlab version in the old version of Matlab?
How to use new functions of new Matlab version in the old version of Matlab? Maybe it is not a good question but the situation is that I have got a MatlabR2008b on my laptop but the PCs of the university got only MatlabR2007b. I just want to use one particular function in the MatlabR2008b on the university machine. How can I do that? Just copy the toolbox? Or can I build the function as a .dll? Thanks! p.s: Of course I can not persuade the university to buy one MatlabR2008... I am also not the administrator; thus, I can not setup my MatlabR2008 on the university machine even I got th...

can u provide a matlab code for image segmentation using supervised active contour model using multivariate gaussian mixture density functions
i have an algorithm for the above,provide your email id so that i can attach algorithm along with thesis. In article <fpej9r$dcf$1@fred.mathworks.com>, varun <varunchandupatla@mathworks.com> wrote: >i have an algorithm for the above,provide your email id so >that i can attach algorithm along with thesis. I'm not sure if I understand you correctly, so I will ask for clarification: Is it correct that you have an algorithm and thesis for a particular type of problem, and you wish someone to code the algorithm in Matlab for you? If so, then are you looking for a volunte...

Using an embedded MATLAB function to calculate discrete filter transfer function coefficients
Hi all, I am using an embedded MATLAB function to sample a sine wave (i.e. the input, call it ans) and store its values inside of the embedded MATLAB function block. I would like to be able to use these stored values with MATLAB code that I write in the embedded MATLAB function block to be able to calculate an output variable. Call the output variable, y. For my case I am using the code: y = 2*ans in the embedded block to compute the output variable, y. Then I want to feed a discrete transfer function block (from the DSP toolbox) with a discrete transfer function that depends on the calculate...

Web resources about - How can I use a Matlab function, whose inputs varies with time (real time function), in simulink - comp.soft-sys.matlab

Wave function - Wikipedia, the free encyclopedia
... (a ball attached to a spring ) in classical mechanics (A-B) and quantum mechanics (C-H). In quantum mechanics (C-H), the ball has a wave function ...

Eating chocolate 'improves brain function' - study
... news for those with a sweet tooth - a recent study has found that regular chocolate consumption is associated with better cognitive function. ...

Cisco launches new network functions virtualization infrastructure solution to help service providers ...
Al-Bawaba Cisco launches new network functions virtualization infrastructure solution to help service providers run network ... Al-Bawaba ...

Google Maps for iOS adds detour function, 3D touch support
Google has extended its pit-stop feature the ability to find places to stop off on journeys to iPhone and iPad users with the release of Google ...

LVMH's Hublot May Be Next Brand for Smart Functions, Biver Says
Hublot will probably be the next LVMH watch brand to add smart functions, following TAG Heuer’s footsteps in combining Swiss craftsmanship and ...

Yahoo Begins Grim Job of Closing Functions, Laying Off Staff
Yahoo Food is closing, and other digital magazines on tech, travel and beauty are also scheduled for closing or major cutbacks.

Can Your Organization's Identity And Function Survive Radical Changes? Lessons From The FBI's Evolution ...
How the FBI transformed after 9/11 provides lessons on how to balance organizational structure, function and identity when they become scrambled. ...

‘World Of Warcraft’ Alpha Removes Gold From Garrison Missions, Water Striders No Longer Function Everywhere ...
... build deploying soon to the alpha server, garrison missions no longer reward gold and the water-walking Water Strider mounts no longer function ...

For $2,950, Never Be Embarrassingly Early To Any Function In This 1984 Toyota Corolla Diesel
We all know it’s a ball to drive a slow car fast, and they don’t come much baller than today’s Nice Price or Crack Pipe Corolla with its diesel ...

Watch How An F1 Car's Tires Function As Part Of Their Suspension
... Formula 1 cars have tires with big sidewalls like your grandpa’s Plymouth. But there’s a reason why there’s so much rubber; these tires function ...

Resources last updated: 3/28/2016 5:52:05 AM