필터 지우기
필터 지우기

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 CenterFile Exchange에서 Fuzzy Logic in Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by