Prev: 3d image
Next: numbers has to be arranged in a matrix
From: Eric on 27 Jan 2010 03:50 Hello! I have to use some trajectories (in time) within a simulink model. I don't want to use the look-up-table provided in simulink, because, as far as I understand, it only works with scalar values. I had to use plenty of them, and this would be very unhandy. The "from workspace"-block in Simulink would be nearly perfect, but I have to restart the trajectories during the execution of the simulink-model. Is there any way to reset the time for this block, or for a subsystem in which this block could be placed? Or do you have any suggestions how to handle look-up tables (in "resetable" time) for vectors (and matrices)? I want to create code with the rtw, therefore I cannot use the "matlab-function"-block with interp1. If not, there's another question: Can I use some higher data-types or classes like struct or cells within an c-s-function if I want to create code with the rtw? Eric
From: Ralph Schleicher on 27 Jan 2010 16:15 "Eric" <noemail(a)noemail.com> writes: > I have to use some trajectories (in time) within a simulink model. I > don't want to use the look-up-table provided in simulink, because, as > far as I understand, it only works with scalar values. I had to use > plenty of them, and this would be very unhandy. Hi Eric, no, lookup tables are IMHO vectorized. See the Simulink documentation. > If not, there's another question: Can I use some higher data-types or > classes like struct or cells within an c-s-function if I want to > create code with the rtw? No, you can only use scalars, vectors, and matrices. All non-double numeric arrays, e.g. character arrays and logical arrays, will be converted into C data type 'real_T'. -- Ralph Schleicher <http://ralph-schleicher.de> Development * Consulting * Training Mathematical Modeling and Simulation Software Tools
From: Eric on 28 Jan 2010 11:53 Hi Ralph, thanks for your answers! But according to the documentation only 1-by-n vectors for both the input values and the data table are supported for the "Simulink->Lookup Tables->Lookup Table"-Block. Which version of Simulink do you refer to? I use Simulink 7.0 (2007b). Best regards, Eric
From: Ralph Schleicher on 28 Jan 2010 16:53 "Eric" <noemail(a)noemail.com> writes: > But according to the documentation only 1-by-n vectors for both the > input values and the data table are supported for the > "Simulink->Lookup Tables->Lookup Table"-Block. Which version of > Simulink do you refer to? I use Simulink 7.0 (2007b). Hi Eric, I always use the "nD Lookup Table" block, even for 1D and 2D lookup tables. You can fine tune interpolation, extrapolation, caching... It's available since Matlab 6 IIRC. -- Ralph Schleicher <http://ralph-schleicher.de> Development * Consulting * Training Mathematical Modeling and Simulation Software Tools
From: Eric on 1 Feb 2010 08:16
Ralph Schleicher <rs+usenet(a)ralph-schleicher.de> wrote in message > [...] > I always use the "nD Lookup Table" block, even for 1D and 2D lookup > tables. You can fine tune interpolation, extrapolation, caching... > It's available since Matlab 6 IIRC. > [...] Hi Ralph, I think I haven't described my problem well enough. I have some matrices, which depend on the time (e.g. the feedforward input, a regulator matrix, ...). Therefore, I need a look-up-table with a scalar input (time) and a m x n (matrix) output. The "nD Lookup Table" can handle more than one input, but I couldn't specifiy a data-matrix, such that the output is a vector or matrix. I.e., the "nD Lookup Table" represent a function of type scalarvalue = f(scalar1, scalar2, ...) whereas I have a function of type vectorvalue = f(scalar) I just solved the problem by creating my own c-s-function, considering the hint from your first reply. (But I'm always interested in learning how it would have been easier.) Thanks, Eric |