help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

permute function in matlab/octave


From: Rick T
Subject: permute function in matlab/octave
Date: Wed, 4 Apr 2012 09:27:14 -1000

I have a working matlab/octave m file but when I convert the M file to a function and run it I get an error in the function saying 'function name' undefined near line 7 column 16.

See M file and Function created below that doesn't work when accessed

clear all, clc,clf,tic
fs
=360;
t
=linspace(0,2*pi,fs);
y
=sinc(t*1);
sigarray
=y;
[array_shifted]=rtpsa(y,180)

Function below:

function [array_shifted]=rtpsa(sigarray,deg_to_shift)
    fs
=length(sigarray)
    aa_sig_combined_L
=zeros(1,length(fs)); %need to reset or will get noise at the end
    a_L
=zeros(1,length(sigarray));

    cycle_permute_lt
= @(sigarray, k) [sigarray(mod((1:end)+k-1, end)+1 )];
    array_phase_shift_div_num
=360/mod(deg_to_shift,360) %keep at 360 to get correct deg angles
    array_phase_shift
=round(fs/array_phase_shift_div_num) %will keep within 360 degs

   
for ii=0:1:fs
        a_L
=cycle_permute_lt(sigarray, ii+array_phase_shift);
        aa_sig_combined_L
= aa_sig_combined_L + a_L;        

   
end;
    array_shifted
=aa_sig_combined_L;

end;


--
--


reply via email to

[Prev in Thread] Current Thread [Next in Thread]