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

  • SEARCH
  • Home
  • 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 6009277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:56:51+00:00 2026-05-23T01:56:51+00:00

If i have two signals that i generated before, how can i make one

  • 0

If i have two signals that i generated before, how can i make one composite signal out of them.
From my understanding composite signal is to let the two signals appear on the same plot (overlap)
so what is the syntax need to prodece that composite signal ??

Note: poth signals have the same time interval.

  • 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-23T01:56:52+00:00Added an answer on May 23, 2026 at 1:56 am

    You need to use the hold function to retain the first plot while you draw the second one over it. Here’s an example:

    x=linspace(0,2*pi,1e3);
    plot(x,sin(2*x))
    hold on
    plot(x,cos(2*x),'r')
    hold off
    

    hold off releases the “hold” and if you plot anything now, the previous plots are not retained. It’s good practice to release the hold so that you don’t inadvertently keep layering multiple plots (unless of course, that’s the intention).


    If you have two signals of widely ranging amplitudes, one option is to scale them so that they’re of comparable amplitudes. This can be achieved for e.g., by normalizing both to a max of 1. E.g.:

    x=linspace(0,2*pi,1e3);
    y=100*sin(2*x);
    z=cos(2*x);
    plot(x,y/max(abs(y)),x,z/max(abs(z)))
    

    You might have to make a note or mention (where ever you’re using this) that the signals have been normalized so that it is clear.

    Alternately you can use the plotyy function which lets you plot two curves with a y-axis for each. E.g.:

    x=linspace(0,2*pi,1e3);
    y=100*sin(2*x);
    z=cos(2*x);
    plotyy(x,y,x,z)
    

    EDIT 2:

    To change the colors in plotyy, you need to use the handles of the lines. Continuing from the above example,

    [ax,h1,h2]=plotyy(x,y,x,z);
    set(h1,'color','m')
    set(h2,'color',[0,0.5,0])
    

    Here I’ve shown two ways to set the color. One is using in-built color strings ('r' -> red, 'm' -> magenta, 'c' -> cyan, 'g' -> green, 'b' -> blue, 'y' -> yellow, 'k'-> black, 'w' -> white) and the other is by a 3 element numeric RGB vector which can take values from 0 to 1.

    Sometimes, it is desirable to not have the y-axes colored (I don’t like them that way). To change them to black, set the value of the 'ycolor' property for ax to black.

    set(ax,'ycolor','k')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two webapplication, one is a simple authenticationsite which can authenticate the logged
I have a basic web server that I generated from the mochiweb framework. To
I have a signal that blocks SIGINT and basically says Sorry, you can't quit.\n
I have two applications written in Java that communicate with each other using XML
I have two identical tables and need to copy rows from table to another.
I have two classes, and want to include a static instance of one class
I have two threads, one needs to poll a bunch of separate static resources
I have two spreadsheets... when one gets modified in a certain way I want
I have two instances of QObject subclasses and two QMetaMethod instances of signal in
I have some server startup code that is lying in the models.py of one

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.