フィルターのクリア

Call Matlab in C (or C++)

1 回表示 (過去 30 日間)
JRC
JRC 2012 年 10 月 17 日
The problem in Matlab:
close all
fis=readfis('aplicacao_laecio_p365'); % search the rule this problem (fuzzy)
time = 10;
p(1)=10; % initial conditions q(1)=15;
f=0.0024; % constant
for t=1:1:time
% input in model (around of 1, fixed)
a(t) = 1; b(t) = 0.9;
% p and q are evolutions (dynamics equations)
resp1 = evalfis([p(t) a(t)],fis);
resp2 = evalfis([q(t) b(t)],fis);
p(t+1) = ((1-resp1(1,1))./2)*resp1(1,2)*resp1(1,3)*exp(-(f)*p(t)).*p(t) + resp2(1,2).*q(t);
q(t+1) = resp1(1,2).*p(t) + ((1-resp2(1,1))./2)*resp2(1,2)*resp2(1,3)*exp(-(f)*q(t)).*q(t);
end
[p; q]'
figure(1)
subplot(2,1,1) plot(p,'o') title('population in time t - N1_t')
subplot(2,1,2) plot(q,'*') title('population in time t - N2_t')
I need to do this program in C (or C++), but I need get values p and q in each iteration in matlab. For example, in each iteration the values resp1 and resp2 are got in matlab, and not C or C++, but is C or C++ that write the answer in '*.txt'. The plot don´t need appear in C or C++.
Who command to call matlab in C or C++?

回答 (1 件)

Sachin Ganjare
Sachin Ganjare 2012 年 10 月 18 日
  1 件のコメント
JRC
JRC 2012 年 10 月 18 日
Thanks Sachin

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

カテゴリ

Help Center および File ExchangeFuzzy Logic in Simulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by