Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

I have written a code to implement a poincare index technique in matlab.Now that,I have to convert the code into C ..Please help me out..Here is the code:

1 Ansicht (letzte 30 Tage)
function [PC,AR] = poincare_index_v1(theeta)
[rows cols] = size(theeta);
Np = 24;
PC = zeros(rows, cols);
AR = zeros(rows, cols);
for i = 4 : rows-4
for j = 4 : cols-4
bx = [i-3 i-3 i-3 i-3 i-3 i-3 i-3 i-2 i-1 i i+1 i+2 i+3 i+3 i+3 i+3 i+3 i+3 i+3 i+2 i+1 i i-1 i-2 i-3];
by = [j-3 j-2 j-1 j j+1 j+2 j+3 j+3 j+3 j+3 j+3 j+3 j+3 j+2 j+1 j j-1 j-2 j-3 j-3 j-3 j-3 j-3 j-3 j-3];
delta = 0;
for k = 0 : Np-1
indx = mod((k+1),Np)+1;
partial_del = theeta(bx(indx),by(indx)) - theeta(bx(k+1),by(k+1));
if(partial_del < (pi/2))
del = partial_del;
elseif (partial_del <= (-pi/2))
del = pi + partial_del;
else
del = pi - partial_del;
end
delta = delta + del;
end
PC(i,j) = delta / (2*pi);
% if(PC(i,j)==(3.533949646070574e-17))
% AR(i,j)=1;
% end
if(PC(i,j)>=0.45 && PC(i,j)<=0.55)
AR(i,j)=1;
end
if(PC(i,j)<=-0.45 && PC(i,j)>=-0.55)
AR(i,j)=2;
end
end
end
end
  2 Kommentare
GOPEE Ajit Kumar
GOPEE Ajit Kumar am 28 Jun. 2016
Hello if you explain to me the code and/or algorithm may be I can help you to convert into C
Guillaume
Guillaume am 28 Jun. 2016
Unless this question is about using matlab coder (for which I can't help), this is not appropriate for this forum.
This is a matlab forum not a C forum.
Furthermore, if you can't convert that basic code (in that it is simply loops and indexing with no high-level functions used) into C on your own, perhaps learning the basics of C is in order?

Antworten (1)

GOPEE Ajit Kumar
GOPEE Ajit Kumar am 28 Jun. 2016
Hello if you explain to me the code and/or algorithm may be I can help you to convert into C

Community Treasure Hunt

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

Start Hunting!

Translated by