Simulink and Embeded Matlab Function

8 ビュー (過去 30 日間)
Sarah Miller
Sarah Miller 2014 年 1 月 11 日
編集済み: Mischa Kim 2014 年 1 月 11 日
Hi, I have a question about working with Embeded Matlab function block in simulink. why this block cant figure out matrix input? for example i wrote a function in this block in the following: function [ y_hat] = fcn(u1, u2, u3, u4, u5, y, P, teta) which size of teta is 4*1 and size of P is 4*4, but when i run my simulink file,matlab thinks that P and teta size are 1*1 Would you pls tell me, how can i cope with it?

採用された回答

Mischa Kim
Mischa Kim 2014 年 1 月 11 日
編集済み: Mischa Kim 2014 年 1 月 11 日
I guess, there might be a bug inside the embedded function. Did you make sure that the matrix-vector operations are all correct? For example, multiply [4x4] x [4x1] rather than the other way around?
Can you share your code as an attachment to your question and the error msg ?
See for example the sample model and code below.
The function looks like this:
function y = fcn(a,b)
x = a*b;
y = dot(x,x);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDeployment, Integration, and Supported Hardware についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by