%Normilisation time window width.half of the max period of the bandpass which is applied to the data prior to cross-correlation. (7Hz-40Hz) N=0.07; %Calculate the size of the signal to get number of columns and rows. n is number of rows and p is number of columns [n,p] = size(signal); %Calculate the normalised weights count = 0 for j = 1:142 %Matrix indexing, each row representing 10 minutes count = count + 1; ten = 240000; %Number of columns %Divide signal into 142 rows and 240000 columns A(count,:) = signal(((j-1)*ten)+1:ten*j);
The above code runs just fine. It takes the signal that I have and divides it into 142 rows and 240000 columns. I now need to calculate the normalisation weight for each row. In the end, I want to have a matrix called weight with the size 142x1, each row should have the calculated weight of it's corresponding row from matrix A. The formula for calculating weight is:
weight =(1/((2*N)+1))*sum(abs(row)).
for i = 1:142 weight(i)=(1/((2*N)+1))*sum(abs(A)); %The A here should be the rows(row1,row2,...till row 142) end
You don't need any loops at all...use the MATrix LABoratory vectorized operations. You already have the the signal in the array, you don't need anything to use it--
weight=1/(2*N+1)*sum(abs(signal),2);
wt = SUM(|signal|)/(2N+1)
and not as
wt = 1/{(2N+1)*SUM(|signal|)}
If it is instead the latter, you'll need
weight=1./((2*N+1)*sum(abs(signal),2));
using the "dot" divide operator for element-wise division.
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.