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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:49:02+00:00 2026-06-14T04:49:02+00:00

I have the following matlab code for approximating a differential equation via the Euler-method:

  • 0

I have the following matlab code for approximating a differential equation via the Euler-method:

% Eulermethod

a=0;
b=0.6;
Steps=6;
dt=(b-a)/Steps;
x=zeros(Steps+1,1);

x(1,1)=1;
y=zeros(Steps+1,1);

for i=1:Steps
    x(i+1,1)=x(i,1)+dt*(x(i,1)*x(i,1)+1);
end
plot(x)

I want to be able to plot the solution plot for several different values of Steps in one plot and have the x-axis go from 0 to 0.6 instead of from for example 1 to 100 000 etc. Can this be done?

  • 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-14T04:49:03+00:00Added an answer on June 14, 2026 at 4:49 am

    If you use the hold on command this will allow you achieve multiple plots on the same figure. Similarly, if you separate your data into x and y vectors, you can plot them against eachother by passing 2 vectors to plot instead of just one. For example

    figure
    hold on
    for i=1:m
        x = [];
        y = [];
        %% code to populate your vectors
        plot(x,y)
    end
    

    You should now see all your plots simultanesously on the same figure. If you want x to be composed of n equally spaced elements between 0 and 0.6, you could use the linspace command:

     x = linspace(0.0,0.6,n);
    

    In order to distinguish your plots, you can pass an extra paramter to the function .For example

     plot(x,y,'r+')
    

    will plot the data as a series of red + symbols.

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

Sidebar

Related Questions

Say I have the following Matlab code: figure; a=plot(1:10); %A pause(); set(a,'ydata',1:2:20); %B pause();
I have written the following code in MATLAB to process large images of the
I have tried the following code in Matlab: function pushbutton5_Callback(hObject, eventdata, handles) global smoothening_level;
I have the following code snippet in Matlab and want to port it to
I have tried following code for creating sparse graph in MATLAB: cm = sparse([1
I have the following MATLAB code: function START_Callback(a,b) global h; global lastVal; global picture1;
For example if I have the following code in MATLAB x = 0:0.1:2*pi; y
I have the following matlab code: randarray = gpuArray(rand(N,1)); N = 1000; tic g=0;
So I have the following matlab code: figure('Properties........'); mainFunctionClass.unzipper(handles); I am trying to create
I have the following code from mathematica and trying to do it with matlab

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.