Squeezing the data in MATLAB

조회 수: 4 (최근 30일)
Syed Bukhari
Syed Bukhari 2015년 8월 19일
댓글: Syed Bukhari 2015년 8월 24일
Hello, I have a set of data with column 1 as frequency, column 2 as quality factor and column 3 as temperature. I have 1200 values of frequency and quality factor and 1921 values of temperature. Is there any way to squeeze the temperature values down to 1200 values? All the data were acquired in the same period of time.
  댓글 수: 2
Walter Roberson
Walter Roberson 2015년 8월 19일
It sounds as if you have multiple lines with the same frequency and quality factor but (potentially) different temperatures. How would you like the data to be reduced? For example would you like to take the mean of the temperatures or would you like to take the minimum ?
Syed Bukhari
Syed Bukhari 2015년 8월 24일
Hi Walter. Both frequency and quality factor change with temperature. Now I want to plot frequency and quality factor as a function of temperature.

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

답변 (1개)

JMP Phillips
JMP Phillips 2015년 8월 20일
편집: JMP Phillips 2015년 8월 20일
If I understand correctly, your data was sampled at different rates, so you need the number of samples in temperature (1921) to match the number of samples in frequency (1200).
We can do this by firstly sampling temperature at a higher rate, so that you have 2400 temperature points (2400 is an integer multiple of 1200). And then sampling the 2400 temperature points at a lower rate (i.e. every second point), so that you have exactly 1200 points.
First step: Resample the temperature data at a higher rate using MATLAB's interp function (see the MATLAB documentation) so that you have 2400 temperature points.
Second step: Remove every second sample to get a temperature vector of size 1200: temperature_size1200 = temperature_size2400(1:2:end);
Alternatively, a rough way to do it (but less precise), is to just resample temperature at the lower rate: temperature_size1200 = temperature_size1921(1:(1921/1200):end);
The problem with this approach, is that (1921/1200) is not an integer, so you lose some accuracy than before if you interpolate the data first at an integer multiple of 1200.
  댓글 수: 1
Syed Bukhari
Syed Bukhari 2015년 8월 24일
Thanks Phillips, Wouldn't that be like same as using interpolate/extrapolate function in Origin or sigma plot? I tried to do that but when I plot sampled temperature values with frequency and quality factor, They shows noise in frequency and quality factor which I cannot understand. I would really appreciate if you can write down a short code for me so that I can compare it with what I am trying to do. Thank you!

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

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by