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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:54:12+00:00 2026-06-15T13:54:12+00:00

I have two graphs, one is measurement (graph2), and one is result from the

  • 0

I have two graphs, one is measurement (graph2), and one is result from the simulation (graph1). I need to plot them on one figure in Matlab but the problem is that graph1 has samples and graph2 has time value assigned to x-axis. How to make time from samples or samples from time to plot them on the same graph ?

enter image description here

This above picture is Graph1 and below is Graph2.

enter image description here

The time when they reach 0 is for:

graph1: x=3444

graph2: x=259

  • 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-06-15T13:54:14+00:00Added an answer on June 15, 2026 at 1:54 pm

    I think your problem is that one plot uses the indices to the samples as its x-values, wheras the other uses actual times as x-values.

    You’ll have to scale the x-axis to have both x-axes describe to the same quantity. I don’t know the specifics of how you take samples, but here’s a simple example:

    figure(1), clf, hold on
    
    % some example data
    x1 = 0:0.1:2*pi;  
    y1 = sin(x1);    
    
    x2 = 0:numel(x1);    % add a bit of noise, just for kicks
    y2 = sin(2*pi*x2/numel(x1)) + 0.02*randn(size(x2));    
    
    % plot naively
    subplot(1,2,1), hold on
    plot(x1, y1, 'r')
    plot(x2, y2, 'b')    
    
    % plot w/ re-scaled x-axis
    subplot(1,2,2), hold on
    plot(x1, y1, 'r')
    
    x2 = linspace(min(x2(:)), max(x1(:)), numel(x2));
    
    plot(x2, y2, 'b')
    

    Output: example output

    Again, the specific implementation of how you should re-scale your x-data depends on specifics of your experiment. You’ll probably have to tinker a bit to get them to correspond.

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

Sidebar

Related Questions

I have two classes (MVC view model) which inherits from one abstract base class.
I have two graphs with in one image, each with 5 points. Their value
I have two graphs and I am trying to overlay one on top of
I am trying to make one figure by stacking two graphs (a) and (b)
I am trying to have two data series plotted in one graph as boxes
I have the data in two files. I want to plot a graph the
With this approach. I have a line plot graph. I want to plot 'two'
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
like two guys before me there and second one there I have difficulty with
I have a huge data frame. One column is an integer ranging from 1

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.