フィルターのクリア

which simulink blocks can I use to create the function below ??

1 回表示 (過去 30 日間)
kamal kiki
kamal kiki 2012 年 2 月 20 日
コメント済み: JOE JOY 2016 年 2 月 2 日
Please which simulink blocks can I use to create the function below ?
fsolve(@(XY)anothertrial(xy,A,B,P1,P2),XY0)
Where A,B, P1 and P2 are variables that will be provided by the results of calculations in other blocks, and XY0 is the value of the guess for the function fsolve.

採用された回答

Kaustubha Govind
Kaustubha Govind 2012 年 2 月 22 日
Function handles were not supported in Embedded MATLAB Function blocks until fairly recently, additionally, fsolve is not amongst the functions supported for code-generation, which are the only functions that can be used directly in a Embedded MATLAB Function block.
The easiest way to do this might be to use an (Interpreted) MATLAB Function block and enter this in the dialog:
fsolve(@(xy)anothertrial(xy,u(1),u(2),u(3),u(4)),xy0)
You can either create the guess xy0 as a workspace variable, or if it is a constant, enter the value directly. Additionally, concatenate your inputs A,B,P1,P2 into a single input using a Mux or Concatenate block, because the Interpreted MATLAB Function block accepts only one input.
  11 件のコメント
huan tu
huan tu 2013 年 5 月 8 日
編集済み: huan tu 2013 年 5 月 8 日
JOE JOY
JOE JOY 2016 年 2 月 2 日
How to concatenate inputs if they are all vectors ? Can we still access those vectors as u(1), u(2), u(3) ?

サインインしてコメントする。

その他の回答 (2 件)

grapevine
grapevine 2012 年 2 月 20 日
You can use either the block Matlab fcn in the "user-defined function" library either a sfunction.
I suggest you to use the first one, in this way you just need to write your function inside a m file and put it as argument of the block
for further details take a look to the doc http://www.mathworks.nl/help/toolbox/simulink/ug/f6-106261.html
  7 件のコメント
grapevine
grapevine 2012 年 2 月 23 日
u should not use the embedded matlab function 'cause it limited u should use the MATLAB Function block as I told u
u have to change the name of the associated Matlab function, for default it's sin u have to write the name of your mfile where you wrote your function
good luck
kamal kiki
kamal kiki 2012 年 2 月 23 日
Yes, It is working !!!!!
Thank you grapevine for your support during these last days.
I am really new in Simulink and Matlab but thanks to friends like you I am doing good progress in my project.
Thanks a million !!!!!.

サインインしてコメントする。


rupa
rupa 2013 年 5 月 21 日
i am trying to generate PWM by watching the video from youtube, i am unable to use fcn block as they have used in the video , i am getting an error stating Warning: Using a default value of 0.2 for maximum step size. The simulation step size will be equal to or less than this value. You can disable this diagnostic by setting 'Automatic solver parameter selection' diagnostic to 'none' in the Diagnostics page of the configuration parameters dialog .
please some1 help me solving this .
Best regards,
  1 件のコメント
Kaustubha Govind
Kaustubha Govind 2013 年 5 月 21 日
編集済み: Kaustubha Govind 2013 年 5 月 21 日
This warning has nothing to do with the Fcn block, it is simply complaining that you have not set a "maximum step size" in the Configuration Parameters window's Solver pane. If you'd like to ignore the warning, you can disable it by following the directions in the warning message.
(Btw, this is a warning, not an error, so you should still be able to simulate and obtain your result)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by