Thursday, 15 September 2011

Matlab not processing second for-loop -


I am trying to verify some accelerator data which I have also compiled by comparing it with Livody Displacements which Were recorded. To do this, I am trying to isolate LVDT data twice to get acceleration. However, when I run my code then there is an error.

  Undefined function or variable 'def deflvdt'   

In this investigation I have found that Matlab The second is not processing for the loop and hence the variable def deflvdt is never done.

Why is it the second skipping for the loop? Enter the code here to clear all the CLC test2 = csvread ('HZ1.csv'); % Raw data from axle time = test2 (:, 1); %% filtering f = 250;% sample frequency f_cutoff = 2; % Cutoff version f_cutoff2 = 5; Fnorm = f_cutoff / (f / 2); Cut from% normalized freak, you can change it to any value based on your requirements fnorm2 = f_cutoff2 / (f / 2); [B1, A1] = Butter (4, Unique, 'Few'); Low pass butterworth filter of order 4 [B2, A2] = butter (4, fernom 2, 'lo'); % Low pass butterfly filter order 4 filtaccZ = filtfilt (b2, a2, test2 (:, 6)); FiltLVDTZ = filtfilt (B1, A1, test2 (:, 7)); Remove %% offset Accz = filtaccZ -main (filtaccZ); LVDTs = FiltLVDTZ - Earth (Filt LVDTZ); %% Unit Conversion LVDTM = LVDTs / 1000; DM = 2: 1: (size (LVDTM) -1) for X = LVDTM (D + 1) AC% displacement for% mm to M%% LVDT displacement; Y = LVDTM (D-1); Z = x-y; % A = differnce in time (d + 1); B = time (D-1); C = A-B; X diffvdt% differnce (d) = (z / c); Deletion at the end velocity = deflate VDT; Speed ​​for acceleration for E = 1: 1: (size) (velocity -1) x2 = velocity (E + 1); Y2 = velocity (E-1); Z2 = x2-y2; In% 2 y = differnce = time (E + 1); B2 = time (E-1); C2 = A2b2; The differnce DiffDiffLVDT (E) = velocity plot (time (1: 5000), ACC (1: 5000), 'B') for ACC (z2 / c2) plot in X (time (1: 5000), excise (1) : 5000), 'R' grid on; box on legend '(DiffDiffLVDTFilter', 'Accz') Enter the code here

because

  1: 1: (size (velocity) -1)   

does not do what you want

velocity one 1xN array, size (velocity) hence [1 N] The colon operator only prefers about the first value of the array. And the array you want to loop is empty at the end

  1: 1: [1 N] -1 == 1: 1: 1-1 == 1 : 1: 0 == Empty Matrix   

Due to such problems, you should always use one of the following instead of size The loop is formed:

  The size (var, n) gives the size of the nth dimension of% var length (var)% gives the largest dimension of var numel (var) in% var Returns the number of elements    

No comments:

Post a Comment