Info
此问题已关闭。 请重新打开它进行编辑或回答。
how to use the type2 fuzzy code available in matlab file exchange, inside a matlab function block in simulink?
1 次查看(过去 30 天)
显示 更早的评论
i am doing a project in switched reluctance motor to control its speed. I am trying to use type2 fuzzy concept. I hav downloaded the .m file from file exchange. I need to convert that .m file into a function so that i could use that inside a matlab function block in my simulink model. Herewith i hav attched the file. The following errors occur when i use this file inside a function. Dimension 2 is fixed on the left-hand side but varies on the right ([1 x 49] ~= [1 x :?]).
Dimension 2 is fixed on the left-hand side but varies on the right ([1 x 49] ~= [1 x :?]).
Function 'tetaon1' (#264.3077.3079), line 100, column 1: "Xl" Launch diagnostic report.
Size mismatch (size [1 x 49] ~= size [1 x 48]). The size to the left is the size of the left-hand side of the assignment.
Function 'tetaon1' (#264.3401.3403), line 113, column 30: "Xl" Launch diagnostic report.
Function call failed.
Function 'tetaon1' (#264.1811.1860), line 57, column 5: "[y(i),yl(i),yr(i)]=EIASC(Y1(:,1)',Y1(:,2)',fl,fu)" Launch diagnostic report.
Errors occurred during parsing of MATLAB function 'tetaon1'(#263)
i am using a .m file to initialize rule matrix X1 and output matrix Y. the values are
X= [-1733 -1300 -866.5 -1733 -1300 -866.5; -1733 -1300 -866.5 -1300 -866.5 -433.4; -1733 -1300 -866.5 -866.5 -433.4 0; -1733 -1300 -866.5 -433.4 0 433.3; -1733 -1300 -866.5 -6.877 426.4 859.9; -1733 -1300 -866.5 433.3 866.5 1300; -1733 -1300 -866.5 866.5 1300 1734; -1300 -866.5 -433.4 -1733 -1300 -866.5; -1300 -866.5 -433.4 -1300 -866.5 -433.4; -1300 -866.5 -433.4 -866.5 -433.4 0; -1300 -866.5 -433.4 -433.4 0 433.3; -1300 -866.5 -433.4 -6.877 426.4 859.9; -1300 -866.5 -433.4 433.3 866.5 1300; -1300 -866.5 -433.4 866.5 1300 1734; -866.5 -433.4 0 -1733 -1300 -866.5; -866.5 -433.4 0 -1300 -866.5 -433.4; -866.5 -433.4 0 -866.5 -433.4 0; -866.5 -433.4 0 -433.4 0 433.3; -866.5 -433.4 0 -6.877 426.4 859.9; -866.5 -433.4 0 433.3 866.5 1300; -866.5 -433.4 0 866.5 1300 1734; -433.4 0 433.3 -1733 -1300 -866.5; -433.4 0 433.3 -1300 -866.5 -433.4; -433.4 0 433.3 -866.5 -433.4 0; -433.4 0 433.3 -433.4 0 433.3; -433.4 0 433.3 -6.877 426.4 859.9; -433.4 0 433.3 433.3 866.5 1300; -433.4 0 433.3 866.5 1300 1734; -6.877 426.4 859.9 -1733 -1300 -866.5; -6.877 426.4 859.9 -1300 -866.5 -433.4; -6.877 426.4 859.9 -866.5 -433.4 0; -6.877 426.4 859.9 -433.4 0 433.3; -6.877 426.4 859.9 -6.877 426.4 859.9; -6.877 426.4 859.9 433.3 866.5 1300; -6.877 426.4 859.9 866.5 1300 1734; 433.3 866.5 1300 -1733 -1300 -866.5; 433.3 866.5 1300 -1300 -866.5 -433.4; 433.3 866.5 1300 -866.5 -433.4 0; 433.3 866.5 1300 -433.4 0 433.3; 433.3 866.5 1300 -6.877 426.4 859.9; 433.3 866.5 1300 433.3 866.5 1300; 433.3 866.5 1300 866.5 1300 1734; 866.5 1300 1734 -1733 -1300 -866.5; 866.5 1300 1734 -1300 -866.5 -433.4; 866.5 1300 1734 -866.5 -433.4 0; 866.5 1300 1734 -433.4 0 433.3; 866.5 1300 1734 -6.877 426.4 859.9; 866.5 1300 1734 433.3 866.5 1300; 866.5 1300 1734 866.5 1300 1734]
Y1=[7.336 9.661 12; 9.661 12 14.35; 7.336 9.661 12; 7.336 9.661 12; 5.185 7.516 9.838; 5.185 7.516 9.838; 2.665 5.003 7.343; 9.661 12 14.35; 7.336 9.661 12; 7.336 9.661 12; 5.185 7.516 9.838; 5.185 7.516 9.838; 2.665 5.003 7.343; 0.3343 2.665 5; 7.336 9.661 12; 7.336 9.661 12; 5.185 7.516 9.838; 5.185 7.516 9.838; 2.665 5.003 7.343; 0.3343 2.665 5; 0.3343 2.665 5; 7.336 9.661 12; 5.185 7.516 9.838; 5.185 7.516 9.838; 2.665 5.003 7.343; 0.3343 2.665 5; 0.3343 2.665 5; -2 0.3343 2.665; 5.185 7.516 9.838; 5.185 7.516 9.838; 2.665 5.003 7.343; 0.3343 2.665 5; 0.3343 2.665 5; -2 0.3343 2.665; -2 0.3343 2.665; 5.185 7.516 9.838; 2.665 5.003 7.343; 0.3343 2.665 5; 0.3343 2.665 5; -2 0.3343 2.665; -2 0.3343 2.665; -4.331 -2 0.3343; 2.665 5.003 7.343; 0.3343 2.665 5; 0.3343 2.665 5; -2 0.3343 2.665; -2 0.3343 2.665; -4.331 -2 0.3343; -4.331 -2 0.3343] The input x is continously changing and it is taken from my model. Is there a way to run a .m file continously. Thank u.
0 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!