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 6742215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:49:01+00:00 2026-05-26T11:49:01+00:00

I have a signal that is created from 0 to 1 for the square,rectangle

  • 0

I have a signal that is created from 0 to 1 for the square,rectangle and the sawtooth signals on the y axis how can I shift the signal down (vertical offset) so the signal will go from -0.5 to 0.5 on the y axis, and change the triangle signal from 0.5 to 1.0 to -0.5 to 0.5?

clear all
% SCRIPT BEGINS
t=linspace(0,1,22050)
freq=5%how many times it repeats in 1 sec
A = 1; % amplitude
T = 1/freq; % period of the signal

% square
square = mod(t * A / T, A) > A / 2;
plot(t, square)
title('Square');

% rectangle
l = 0.2; % percentage the signal spends on low value
rectangle = mod(t * A / T, A) > A * l;
figure;
plot(t, rectangle);
title('Rectangle');

% sawtooth
sawtooth = mod(t * A / T, A);
figure;
plot(t, sawtooth);
title('Sawtooth');

% triangle
triangle = (mod(t * A / T, A) > 0.5).*mod(t * A / T, A) + (mod(t * A / T, A) <= 0.5).*(1 - mod(t * A / T, A));
figure;
plot(t, triangle);
title('triangle');

thanks I’m using octave/matlab

  • 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-26T11:49:02+00:00Added an answer on May 26, 2026 at 11:49 am
    function x_new = rescale(x, new_min, new_max)
    
    x_min = min(x);
    x_max = max(x);
    
    x_new = new_min + (new_max - new_min) * (x - x_min) / (x_max - x_min);
    

    (BTW this is very basic math that could have been easily googled)

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

Sidebar

Related Questions

I have a signal that blocks SIGINT and basically says Sorry, you can't quit.\n
I have created a pthread, and installed a signal handler inside that, same way
I have a buffer in class 'bufferClass' that will generate a signal to tell
Whenever I use the signal/slot editor dialog box, I have to choose from the
I have an object that is derived from QThread and the class definition includes
I have created an Html 5 page that provides important server-side functionality. Unfortunately, it
I have created a class that inherits the QListWidget and is meant to be
Lets say I have created a Thread from within a control to monitor for
I have a basic web server that I generated from the mochiweb framework. To
What is the proper technique to have ThreadA signal ThreadB of some event, without

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.