Call Matlab in C (or C++)
조회 수: 1 (최근 30일)
이전 댓글 표시
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++?
댓글 수: 0
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Fuzzy Logic in Simulink에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!