Call Matlab in C (or C++)

1 Ansicht (letzte 30 Tage)
JRC
JRC am 17 Okt. 2012
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++?

Antworten (1)

Sachin Ganjare
Sachin Ganjare am 18 Okt. 2012

Kategorien

Mehr zu Fuzzy Logic in Simulink finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by