f



Sampling in 'Embedded matlab func.'

Hi
 
I have a problem with correcting the samplingtime in the 'embedded
matlab func.' block. Is it possible to set the samplingtime in this
block likewise the main samplingtime. The main sampling is a
fixed-step size=1, but the embedded block samples 12 times as often.
 
Somebody got a solution to my problem??
 
Martin
0
9/10/2004 6:19:37 AM
comp.soft-sys.matlab 211266 articles. 22 followers. lunamoonmoon (257) is leader. Post Follow

4 Replies
555 Views

Similar Articles

[PageSpeed] 26

Hi Martin,
is your system continous and you are using a continous solver (e.g. ode45)?
Then you see the integration steps of the solver...
Other possibilities are e.g. additional calls because of algebraic loop,
smaller time steps of the variable step solver to ensure relative tolerance.

Titus

"Martin Hogsbjerg" <martin@hogsbjerg.dk> wrote in message
news:eee9629.-1@webx.raydaftYaTP...
> Hi
>
> I have a problem with correcting the samplingtime in the 'embedded
> matlab func.' block. Is it possible to set the samplingtime in this
> block likewise the main samplingtime. The main sampling is a
> fixed-step size=1, but the embedded block samples 12 times as often.
>
> Somebody got a solution to my problem??
>
> Martin


0
tedelhof (480)
9/10/2004 7:38:37 AM
Hi Titus

Thanks for the reply..
Our system is discrete, and we are using the fixed step solver. Is it
possible to get the embedded matlab func. to execute one time each
sample?

Martin

Titus Edelhofer wrote:
>
>
> Hi Martin,
> is your system continous and you are using a continous solver (e.g.
> ode45)?
> Then you see the integration steps of the solver...
> Other possibilities are e.g. additional calls because of algebraic
> loop,
> smaller time steps of the variable step solver to ensure relative
> tolerance.
>
> Titus
>
> "Martin Hogsbjerg" <martin@hogsbjerg.dk> wrote in message
> news:eee9629.-1@webx.raydaftYaTP...
>> Hi
>>
>> I have a problem with correcting the samplingtime in the
> 'embedded
>> matlab func.' block. Is it possible to set the samplingtime in
> this
>> block likewise the main samplingtime. The main sampling is a
>> fixed-step size=1, but the embedded block samples 12 times as
> often.
>>
>> Somebody got a solution to my problem??
>>
>> Martin
>
>
>
0
9/10/2004 12:08:28 PM
Hi Martin,
you have a discrete system, O.K. May be a silly question, but do you also
use the discrete solver? (popup-menu: discrete (no continous states))
If so, I don't know, where the problem is. If you use one of the others
(e.g., ode3), the problem remains the same.
If you want to be sure, that your block is called at some specific times,
put it into a triggered subsystem, and specify the trigger accordingly.

Titus

"Martin" <martin@hogsbjerg.dk> wrote in message
news:eee9629.1@webx.raydaftYaTP...
> Hi Titus
>
> Thanks for the reply..
> Our system is discrete, and we are using the fixed step solver. Is it
> possible to get the embedded matlab func. to execute one time each
> sample?
>
> Martin
>
> Titus Edelhofer wrote:
> >
> >
> > Hi Martin,
> > is your system continous and you are using a continous solver (e.g.
> > ode45)?
> > Then you see the integration steps of the solver...
> > Other possibilities are e.g. additional calls because of algebraic
> > loop,
> > smaller time steps of the variable step solver to ensure relative
> > tolerance.
> >
> > Titus
> >
> > "Martin Hogsbjerg" <martin@hogsbjerg.dk> wrote in message
> > news:eee9629.-1@webx.raydaftYaTP...
> >> Hi
> >>
> >> I have a problem with correcting the samplingtime in the
> > 'embedded
> >> matlab func.' block. Is it possible to set the samplingtime in
> > this
> >> block likewise the main samplingtime. The main sampling is a
> >> fixed-step size=1, but the embedded block samples 12 times as
> > often.
> >>
> >> Somebody got a solution to my problem??
> >>
> >> Martin
> >
> >
> >


0
tedelhof (480)
9/10/2004 12:34:42 PM
Hi Titus,
Yes I am using that solver, but I will try using the trigged
subsystem, thank you.

Martin

Titus Edelhofer wrote:
>
>
> Hi Martin,
> you have a discrete system, O.K. May be a silly question, but do
> you also
> use the discrete solver? (popup-menu: discrete (no continous
> states))
> If so, I don't know, where the problem is. If you use one of the
> others
> (e.g., ode3), the problem remains the same.
> If you want to be sure, that your block is called at some specific
> times,
> put it into a triggered subsystem, and specify the trigger
> accordingly.
>
> Titus
0
9/10/2004 1:09:04 PM
Reply:

Similar Artilces:

'Matlab Code' to 'Embedded Matlab fun code'
Dear friends, I have a Matlab code to process a pure analog signal 'u'. Now I want to implement it in Simulink and I want to use it in 'Embedded Matlab fun block' so i need to transform 'Matlab code' to 'Embedded Matlab fun code' to perform the task. The Matlab code is as follows: %%%%%%%%%%%%%%%%%%%%% u_abs = abs(u); major_th = 1.5e-1; minor_th = 1.8e-2; major_peak_value = []; minor_peak_value = []; pos = 1; pos_max = 1; while ~isempty(pos) [m pos_max(end+1)] = max( u_abs( pos : pos + 10) ); pos...

Performance of Matlab 'zip' and 'unzip' functions
I'm using matlab 6.5 and I just realized that it comes with zip and unzip functions. On the first try it seems that the matlab zip functions are slower than other commonly available programs e.g. winzip, winrar. Anyone has any reliable data about the performance of Matlab zip and unzip functions? Failing that, personal experience is good too. Thanks! Terence Leong wrote: > > > I'm using matlab 6.5 and I just realized that it comes with zip and > unzip functions. On the first try it seems that the matlab zip > functions are slower than other commonly available programs ...

'is not' or '!='
A newbie question to you; what is the difference between statements like: if x is not None: and if x != None: Without any context, which one should be preferred? IMHO, the latter is more readable. On 2014-08-18 21:35, ElChino wrote: > A newbie question to you; what is the difference between statements > like: > if x is not None: > and > if x != None: > > Without any context, which one should be preferred? > IMHO, the latter is more readable. > "x == y" tells you whether x and y refer to objects that are equal. "x is y" tells you whether x and y actually refer to the same object. In the case of singletons like None (there's only one None object), it's better to use "is". "ElChino" <elchino@cnn.cn>: > A newbie question to you; what is the difference between statements > like: > if x is not None: > and > if x != None: Do the following: take two $10 bills. Hold one bill in the left hand, hold the other bill in the right hand. Now, the bill in the left hand "is not" the bill in the right hand. However, the bill in the left hand "==" the bill in the right hand. > Without any context, which one should be preferred? > IMHO, the latter is more readable. In almost all cases, both tests would result in the same behavior. However, the "is not" test is conceptually the correct one since you want...

'^=' and '~='?
Hello, What is the difference between '^=' and '~='? Thanks, Duckhye ...

calling '!' or 'system' in matlab different than same functions from shell
Hi everyone, When I am in the shell (tcsh) on my Mac (outside Matlab), I am able to use the command line utility ncdump to read netcdf format files (http://www.unidata.ucar.edu/software/netcdf/): ncdump -h testfile.nc However, in Matlab, the same command preceded by the '!' (or using 'system') generates an error: >> !ncdump -h test.nc dyld: Library not loaded: /opt/local/lib/libnetcdf.7.dylib Referenced from: /opt/local/bin/ncdump Reason: Incompatible library version: ncdump requires version 10.0.0 or later, but libnetcdf.7.dylib provides version ...

How to display a 'displacement field' or 'displacement vector' in Matlab?
Hi All, I am doing a non-rigid image registration project, and just came across a question that how to display a 'displacement field' or 'displacement vector' in Matlab? I found some similar question at: http://www.mathworks.com.au/matlabcentral/answers/8030-displacement-vector without a good solution. Basically, we have got two two images (2D or 3D) in same size. And by using the registration we can get a 'displacement field' which will transform the coordinates of one image to another. Examples of the graph of the 'displacement field' is here in 2D:...

ndefined function or variable 'y'. The first assignment to a local variable determines its class. Function 'Embedded MATLAB Function' (#52.384.385), line 19, column 2: "y"
Hi everybody I have a serious problem and i need your help. i use embedded matlab function in simulink to generate some matrices which i use as input to other bloc on simulink. But i got this error while the simulation is running: Undefined function or variable 'y'. The first assignment to a local variable determines its class. Function 'Embedded MATLAB Function' (#52.384.385), line 19, column 2: "y" My code is function y = fcn(u) Ap=[0.9580 0 0 0;0 0.9418 0 0;0 0 0.9048 0;0 0 0 0.9277]; Bp=[0.25 0;0.25 0;0 0.5;0 0.5]; Cp=[0.1678 0 0.9516 0;0 0.2329 0 0.2890]; [m1,n1]=size(Cp); [n1,n_in]=size(Bp); A_e=eye(n1+m1,n1+m1); A_e(1:n1,1:n1)=Ap; A_e(n1+1:n1+m1,1:n1)=Cp*Ap; B_e=zeros(n1+m1,n_in); B_e(1:n1,:)=Bp; B_e(n1+1:n1+m1,:)=Cp*Bp; C_e=zeros(m1,n1+m1); C_e(:,n1+1:n1+m1)=eye(m1,m1); y(1:m1,:)=C_e; for kk=1:u-1; y((m1*kk)+1:m1*(kk+1),:)=y(m1*(kk-1)+1:m1*kk,:)*A_e; end thank you so much On 07/16/2014 5:50 AM, AGUEMON wrote: .... .... > ...i got this error while the simulation is > running: > > Undefined function or variable 'y'. The first assignment to a local > variable determines its class. > Function 'Embedded MATLAB Function' (#52.384.385), line 19, column 2: > "y" > .... > C_e(:,n1+1:n1+m1)=eye(m1,m1); > y(1:m1,:)=C_e; > > for kk=1:u-1; > y((m1*kk)+1:m1*(kk+1),:)=y(m1*(kk-1)+1:m1*kk,:)*A_e; .... Never used the em...

Matlab draw 'subaxis' based subplots on specified 'axes'
Hi smart guys, I am coding some GUI staff using Matlab. And I want to plot a figure with subfigures in one specified 'axes' using 'subaxis' method (which can be download on Matlab FX [subaxis.m][1]). The program behaves quite right at first. As the subfigures are updating by one click button. Then the error pops-up. I simplify the problem and write some testing codes as following: % Specify an 'axes' in my GUI (here is an example of axes handle called 'ax') ax = axes; axes(ax); cla(ax, 'reset'); % Plot something using &#...

Matlab's 'graycomatrix' function
I have one question: Is Matlab's 'graycomatrix' function actually in accordance with original Haralick's 1973 paper? I mean, are they supposed to be the same algorithm? If yes, I don't think Matlab did a good job on this. For example, try it on this matrix (i.e., 'image'): 0 0 1 1 0 0 1 1 0 2 2 2 2 2 3 3 This matrix is in Haralick's original paper and the results can be compared. Can anybody ellaborate if you used it? Thank you. "Bulent Bayraktar" <bayrakta@purdue.edu> writes: > I have one question: Is Matlab's 'graycomatrix' function actually in > accordance with original Haralick's 1973 paper? > I mean, are they supposed to be the same algorithm? If yes, I don't > think Matlab did a good job on this. > > For example, try it on this matrix (i.e., 'image'): > 0 0 1 1 > 0 0 1 1 > 0 2 2 2 > 2 2 3 3 > > This matrix is in Haralick's original paper and the results can be > compared. > > Can anybody ellaborate if you used it? You do need to understand a bit about the conventions used in the software you are using. For example, the Image Processing Toolbox's default black-to-white range for double-precision inputs is [0, 1]. The reference page for graycomatrix describes in detail what it does. By default, for example, it quantizes the range [0, 1] into 8 levels, resulting in an 8-by-8 co-occurrence matrix. But for your matrix, it is seeing 5 &qu...

MatLab's 'movie' function
Hi! Using MatLab's 'movie' function you can play a movie recorded by the 'getframe' command. It is possible to specify the number of times the movie is played and the frames per second. Unfortunately, I've not found a way to stop the playback of a movie. Is it possible to, let's say I've specified the movie should be played 20 times, to disrupt the playback after an user interrupt?! Thanks a lot, Chris On Sat, 12 Feb 2005 10:40:06 +0100, Christoph ROLZ wrote: >Hi! > >Using MatLab's 'movie' function you can play a movie recorded by the >'getframe' command. It is possible to specify the number of times the >movie is played and the frames per second. > >Unfortunately, I've not found a way to stop the playback of a movie. > >Is it possible to, let's say I've specified the movie should be played >20 times, to disrupt the playback after an user interrupt?! > >Thanks a lot, > Chris if you want to play the movie, tried thi command index is the number of frame in video file. index = 1:100 mov = aviread('filename',index) for i = 1: 100 frame = mov(i).cdata; imshow(frame) end Please try it. ...

'Make Error' on embedded Matlab functions
When using an embedded matlab function block, using exactly the same code that I had working in an ordinary matlab function, I get make errors, always with the line: /bin/bash: line 1: make: command not found Can anyone help? Thanks, Rob Hi Rob, It looks like you do not have 'make' on your path. What operating system/platform are you using? Try running >> mex -setup from MATLAB. That should fix this problem. Good luck. -Fred Robert Durnford wrote: > > > When using an embedded matlab function block, using exactly the > same > code that I had working in a...

Can Matlab write 'single' or 'double' precsion grayscale Tiffs?
Hi If I open a 32-bit or 64-bit grayscale Tiff into MatLab and then write it again it is converted into an 8-bit image. imwrite(Image,'image.tif','Compression','none') but if Image is 32-bit or 64-bit floating point then image.tif gets written as an 8-bit image. How can I maintain the precision when using imwrite to save the image? Thanks John ...

'''''''''''''The Running Update/Append Queries Using VBA code Ordeal''''''''''''''
Hello fellow programmers, I am trying to run an append/update query from code, a command button on a form initiates the queries. the format i am using is; _____________________________________________________ SELECT "criteria" FROM "criteria" WHERE "criteria" UPDATE/APPEND "field selections" RecordSource "qryExample" = above text strings" _______________________________________________________________________ When i am running a SELECT query in this manner it works fine with no problems, and accepts the values of specified linked form fields. This never works when doing an APPEND/UPDATE query. It can never find the values of linked form fields, Access always asks for the parameter value of the field(s) in question, or Access comes up with an error 3323 - No recordset. I am sure there are other people that have had this problem. What is the difference between Select queries and append/update queries? the append/update queries never seem to be able to find values in linked form fields. Can anyone shed any light on this or point to a knowledgebase Item, or even recommend a book focusing on this subject, I will go and buy it now. I have been for up 2 nights trying to acomplish this and now considering suicide, please help. Thanks In advance, Aaron. I know of two ways you can accomplish this. 1. You can create the SQL script for you append or update query and run the script with DoCmd.RunSQL. 2. You can create a...

Error while simulating 'Embedded MATLAB Function' Block in Siumulink
I have Just written a simple code to calculate the Sampling Error between 2 signals in a M file and included it in the 'Embedded MATLAB Function' Block of Simulink. Whenever I try to run this model, it shows me the following error: Unable to locate 'mexopts.bat', and therefore cannot determine which compiler to use for simulation builds. Use 'mex -setup' to select a supported compiler. The mex setup says I have no compilers found. Please help me with a direct solution to his problem Thanks... ...

??? Unrecognized assertion predicate 'strcmp'/ Embedded Matlab Error
I am trying to compile a simple function that calculates the roots of a polynomial using emlc PolyRoots I do get however the following error ??? Unrecognized assertion predicate 'strcmp'. Error in ==> PolyRoots Line: 13 Column: 12 Compilation failed: Open error report. though i know strcmp is recognized by the Embedded Matlab Attached the code of the function, any help? function y = PolyRoots(u) %#eml %************************************************* % This program finds the roots of a polynomial %************************************************* eml.extrinsic(&...

matlab 'Killed'
Hi I have a problem with matlab saying just 'Killed' then exiting when large data is used. Is there some parameters one can adjust to prevent this ? What is the cause of the problem ? Memory ? -sgrongst ...

matlab being 'Killed'
Hi I have a problem with matlab saying just 'Killed' then exiting when large data is used. Is there some parameters one can adjust to prevent this ? What is the cause of the problem ? Memory ? -sgrongst ...

'''''''''''''The Running Update/Append Queries Using VBA code Ordeal'''''''''''''' #2
Hi, Thanks for ur help there HJ. I know how to do the tasks you specified there. I would like for the update query to use field values from some of the fields on the form (frmInvoices) such as InvoiceNumber, DateFrom, DateTo. My problem is that an append/update query can't find the values in the open Form (frmInvoices) when I specify them as; [Forms]![frmInvoices]![InvoiceNumber] a select query has no problem finding the field values on a form. please help. Aaron Hi Aaron, Could you post the entire code that you are having trouble with? Now it is not possible to see what goes wrong. HJ "Aaron" <aaron@rapid-motion.co.uk> wrote in message news:260d7f40.0408120245.2f3d01f8@posting.google.com... > Hi, > > Thanks for ur help there HJ. > > I know how to do the tasks you specified there. > > I would like for the update query to use field values from some of the > fields on the form (frmInvoices) such as InvoiceNumber, DateFrom, > DateTo. My problem is that an append/update query can't find the > values in the open Form (frmInvoices) when I specify them as; > > [Forms]![frmInvoices]![InvoiceNumber] > > a select query has no problem finding the field values on a form. > > please help. > > Aaron First off, if you are not always using all the parameters specified in your form, then you have to add parameters to your query on the fly. Also, you can't just do something like qdf.SQL = "SE...

if str_mo not in ('','.') and str_da not in ('','.') and str_yy not in ('','.') Any shorter ?
Hi, there. =20 I'm just curious if it ever dawned on anybody how to abbreviate this line : if str_mo not in ('','.') and str_da not in ('','.') and str_yy not in ('','.')=20 =20 Igor Kurbeko Clinical Programmer Analyst 678 336 4328 ikurbeko@atherogenics.com =20 no brain no pain =20 how about: if not (str_mo in ('','.') or str_da in ('','.') or str_yy in ('','.')) OR if not (missing(str_mo) or missing(str_da) or missing(str_yy)) Eric On 22 Oct 03 21:13:37 GMT, ikurbeko@ATHER...

How to input frame-based data into 'Embedded MATLAB Function' block?
How do I input frame-based data into 'Embedded MATLAB Function' block? Simulink seems to give an interface error when building it. The error message reads: Cannot propagate frame data to input "u" of "Embedded MATLAB Function" because this input port expects non-frame data; consider innserting an Unbuffer. Any ideas on how to input frame-based data? Bartok wrote: > How do I input frame-based data into 'Embedded MATLAB Function' > block? Simulink seems to give an interface error when building it. > The error message reads: > > Cannot propag...

Why 1st order PDE's are not 'proper' for MATLAB?
Hello all, I have a first order 1-D PDE problem of thte form: dx(u1)= f(u1,u2,x,t) dt(u2)=g(u1,u2,x,t) I was looking at the former discussions on this topic. Almost all the people posting this problem got the following error: ?? Error using ==> c:/matlab6p5/toolbox/matlab/funfun/private/daeic12 This DAE appears to be of index greater than 1. In most of the replies it was stated that pdepe is not suitable for solving first order PDE's. Moreover, the PDE toolbox of the MATLAB also does seem to handle only second order PDE's as well. After writing these observations, I want to as...

A function with 'and' , 'not' , 'null' , 'car' and 'cdr'
What's this ? (defun enigma (x) (and (not (null x)) (or (null (car x)) (enigma (cdr x))))) "I suppose I should learn Lisp, but it seems so foreign." - Paul Graham, Nov 1983 On Wed, Oct 07 2015, CAI GENGYANG wrote: > What's this ? > > > (defun enigma (x) > (and (not (null x)) > (or (null (car x)) > (enigma (cdr x))))) Bad taste? It returns T if the list X contains nil as an element. It would be clearer to write (some #'null x). Helmut CAI GENGYANG ...

error: expected '=', ',', ';', 'asm' or '__attrib
Hi I'm trying to compile an ADC Driver & come acrosss the following error. I've no experience writing drivers before, and hence have no clue how to fix it. Hope someone out there has encountered the problem & suggesst a fix for the same. The Error is I get is : qadc.c: At top level: qadc.c:97: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'qadc_read' make: *** [qadc.o] Error 1 [root@localhost qadc]# ########################################################################### ADC Driver Code ##...

error: expected '=', ',', ';', 'asm' or '__attrib
Hi I'm trying to compile an ADC Driver & come acrosss the following error. I've no experience writing drivers before, and hence have no clue how to fix it. Hope someone out there has encountered the problem & suggesst a fix for the same. The Error is I get is : qadc.c: At top level: qadc.c:97: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'qadc_read' make: *** [qadc.o] Error 1 [root@localhost qadc]# ########################################################################### ADC Driver Code ########################################################################### #define MODULE #define __KERNEL__ #include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> /* printk */ #include <linux/fs.h> / #include <linux/errno.h> /* error codes */ #include <linux/types.h> /* size_t */ #include <linux/proc_fs.h> /* proc file system */ #include <linux/fcntl.h> #include <asm/system.h> /* cli, flags */ #include <asm/uaccess.h> /* copy from/to user */ /*Registers to get qadc access*/ volatile unsigned short * qadcmcr = (unsigned short *)0x40190000; volatile unsigned short * qacr0 = (unsigned short *)0x4019000a; volatile unsigned short * qacr1 = (unsigned short *)0x4019000c; volatile unsigned short * qacr2 = (unsigned short *)0x4019000e; volatile unsigned short * qasr0 = (unsigned short *)0x40190010; volatile unsigned short * qasr1...

Web resources about - Sampling in 'Embedded matlab func.' - comp.soft-sys.matlab

Resources last updated: 3/27/2016 5:22:50 AM