Can someone please tell me where is my fault?

1 view (last 30 days)

Accepted Answer

Walter Roberson
Walter Roberson on 2 Sep 2015
At line 11 insert
AKM = zeros(4,1);
or
AKM = zeros(1,4);
as appropriate. That way Simulink will not have to "grow" AKM as you assign the values to AKM(1), AKM(2) and so on.
  27 Comments
Walter Roberson
Walter Roberson on 13 Sep 2015

I still do not understand about the Ramp or why M_ter is being read from a file instead of being passed as a signal, or why you are passing I_phod as a signal but ignoring the value. Still here is the version with 7 values expected for M_ter

function M_ter = get_Mter()
%this is a new function. It must be stored in get_Mter.m
    coder.extrinsic('xlsread');
    filename = 'Moment_terecenja' ;
    coder.varsize('T', [1 0]);
    T = zeros(64,1);          %we only expect 7 values but allow up to 64 before we bomb
    T = xlsread(filename) ;
    M_ter = zeros(7,1);
    M_ter = T(1:7,1);

First block

function nnovo = fcn(n, M_ter, I_phod)
    I_phod = 4.17 ;
    n_phod = 1498 ;
    M_ter = zeros(7,1);
    M_ter = get_Mter();
    nnovo = zeros(7,1) ;
    nnovo = -0.0284 * M_ter.^2 - 1.3569 * M_ter + n_phod ;

Second block

function I = fcn(n, M_ter, I_phod)
    I_phod = 4.17 ;
    M_ter = zeros(7,1);
    M_ter = get_Mter();
    I = zeros(7,1) ;
    I = 0.0033 * M_ter.^2 + 0.1019 * M_ter + I_phod ;

Third block

function eta = fcn(n, M_ter, I_phod)
    M_ter = zeros(7,1);
    M_ter = get_Mter(); 
    eta = zeros(7,1) ;
    eta = -0.001 * M_ter.^2 + 0.0588 * M_ter ;

Fourth block

function cos_phi = fcn(n, M_ter, I_phod)
    M_ter = zeros(7,1);
    M_ter = get_Mter(); 
    cos_phi=zeros(7,1) ;  
    cos_phi = -0.0008 * M_ter.^2 + 0.0542 * M_ter - 0.3941 ;
Milan Grahovac
Milan Grahovac on 20 Sep 2015
I have finished my work succesfully, thank you for all your help. Greetings!

Sign in to comment.

More Answers (0)

Categories

Find more on Event Functions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!