Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4330568
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:58:49+00:00 2026-05-21T09:58:49+00:00

Greetings All I went back and used resample (from the signal processing toolbox) and

  • 0

Greetings All

I went back and used resample (from the signal processing toolbox) and repmat, but I’m noticing that on some of the values the rows aren’t the same as the sample rate, see image link below. notice the top image value for rows says 1000 and the bottom image says rows = 1008. This happens when I change the values of resample and repmat (freq_new) but only for certain values. How can I fix this correctly? I could just delete everything after 1000 but I’m not sure if this is a bug or just the way resample/repmat works. PS: using matlab/octave

http://dl.dropbox.com/u/6576402/questions/rows_different.png

Here’s the test code I used to test this

%resample_repmat signal
clear all, clf
Fs = 1000; % Sampling rate
Ts = 1/Fs; %sampling interval
t=0:Ts:1-Ts; %sampling period

freq_orig=1;
y=sin(2*pi*t*freq_orig)'; %gives a short wave

freq_new=9;
y2=resample(y,1,freq_new); %resample matrix
y3=repmat (y2,freq_new,1); %replicate matrix

[r_orig,c_orig] = size(y) %get orig number of rows and cols
[r_new,c_new] = size(y3) %get new number of rows and cols

subplot(2,1,1),plot(y),title('Orginal signal')
title(['rows=',num2str(r_orig),' cols=',num2str(c_orig)])
subplot(2,1,2),plot(y3),title('New signal')
title(['rows=',num2str(r_new),' cols=',num2str(c_new)])
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T09:58:50+00:00Added an answer on May 21, 2026 at 9:58 am

    Since your original signal is 1000 samples long, resampling it with a period 9 times shorter would give you 111.11111… samples in one cycle. Matlab rounds this number up to 112. Think about it. If your cycles were 111 samples long, your complete wave would be 999 samples long. Because it’s 112 samples long, when you put nine of them together they produce a 1008-samples-long signal. There is no way to make it 1000, because you’re dealing with discrete times. The code is right, it does what it’s supposed to. There is physically no way to fit precisely 9 identical cycles of anything into 1000 discrete samples. I hope this helps.

    Alternatively, you can try first repeating your initial wave nine times and then resampling it. Your cycles would not be identical, but they would fit nicely into the 1000 samples.

    I hope this helps = )

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Greetings all, I have some JSON code that looks like this: { playlist: [
Greetings All! I am having some troubles on how to execute thousands upon thousands
Greetings all! Looking for some help with MVC in a PHP context. Currently I
Greetings all, I'm trying to localize a .NET/C# project. I'm using string resource files
Greetings to all! This is my first question here on stackoverflow. I have a
I am new here so first of all my greetings to you I am
Greetings, I'm trying to find a way to 'unbind' a socket from a particular
Greetings! I'm working on wrapping my head around LINQ. If I had some XML
Greetings! I am trying to check directory write-permissions from within a Windows MFC/ATL program
Greetings all, Is there a built in way to know when a user is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.