Gaussian filtering of Adcole Roundness data

8 ビュー (過去 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 Center および File ExchangeAudio Processing Algorithm Design についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by