Call Matlab in C (or C++)

3 visualizaciones (últimos 30 días)
JRC
JRC el 17 de Oct. de 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++?

Respuestas (1)

Sachin Ganjare
Sachin Ganjare el 18 de Oct. de 2012
  1 comentario
JRC
JRC el 18 de Oct. de 2012
Thanks Sachin

Iniciar sesión para comentar.

Categorías

Más información sobre Fuzzy Logic in Simulink en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by