Gaussian filtering of Adcole Roundness data

조회 수: 10 (최근 30일)
Vadim Baines-Jones
Vadim Baines-Jones 2014년 8월 13일
댓글: Stephen23 2015년 1월 22일
Hi all,
I'm having trouble working through the examples in the book "Computational surface and roundness metrology". When attempting to run the following program, I get the following error. I'm trying to get my head around the line of S1(blah) = S. I don't understand how this can work but I've placed it in exactly as described in the book. Any help you give is greatly appreciated.
omegac = 20; % Cutoff in units of UPR (undulations per revolution)
n = 3600; % number of points measured (3600 = 0.1 of a degree)
alpha = sqrt(log(2)/pi);
i = (-n/omegac:1:n/omegac)'; %n/omegac is the number of points in one cutoff
x = i*omegac/n;
S = (omegac/alpha).*exp(-pi*(i.*omegac/alpha/n).^2);
S = S/sum(S);
plot(x,S)
q = (1:n)';
theta = (q-1)/n*2*pi; % Generate angle data
R = sin(2*pi/n*omegac.*q); % profile with UPR
% note that the variable R is used to indicate radial deviation data
% plot(theta,R)
S1(3600,1) = 0; % Generate an array with 3600 points
S1(1441:2161,1) = S; % Centre filter in S1
Sf = fft(S1); % FFT of S1
Rf = fft(R); % FFT of R
wf = Sf.*Rf; % term by term multiplication
w = ifft(wf); % inverse FFT of wf
w = [w(1801:3600,1);w(1:1800,1)];
plot(theta,R,'b-',theta,w ,'r-')
radius = 20; %Enter the radius of the polar plot)
polar(theta, R + radius)
hold on;
polar(theta,w + radius, 'r-')
ERROR
Subscripted assignment dimension mismatch.
Error in gauss_test2 (line 25)
S1(1441:2161,1) = S; % Centre filter in S1
I'd like to input 3600 point data from my Adcole and apply a Gaussian filter to the FFT with certain UPR settings then convert back to the time domain.
Any advice or examples?
  댓글 수: 1
Stephen23
Stephen23 2015년 1월 22일
Advice: you should not use i or j as variables names, as these are the names of the inbuilt imaginary unit . You might need a complex number one day, and then it is a real pain because you have redefined those variables.

댓글을 달려면 로그인하십시오.

답변 (1개)

Star Strider
Star Strider 2014년 8월 13일
The S vector is a (361x1) double array and the subscript range [1441:2161] is 721.
That mismatch is throwing the error.
I’m not sure what you’re doing, so I can’t suggest a fix other than to define the subscript range as [1441:1441+length(S)-1] or create S to be a (721x1) vector.

카테고리

Help CenterFile Exchange에서 Audio Processing Algorithm Design에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by