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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:54:06+00:00 2026-05-31T05:54:06+00:00

I am trying to create a 3D plot in Matlab. I have a very

  • 0

I am trying to create a 3D plot in Matlab.

I have a very long problem starting with the data set of Y and Z. With much manipulation it boils down to a simple y/z problem

y=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
z=[5, 10, 15, 20, 25, 30, 35, 40, 45, 50];


x=(y_new)/(z_new)

There is about 100 lines of equations manipulating y and z, to become two new variables y_new and z_new. I would like to create a 3d plot of x,y,z. I would want an x value for (1,5) and (1,10), (2,5), (2,10) etc.

The way I have the problem setup is only using y=1 and z=5. I have been trying to use for-loops or while-loops for the past few hours but I am getting stuck.

If someone can help me I would appreciate the time and effort!

  • 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-31T05:54:08+00:00Added an answer on May 31, 2026 at 5:54 am

    You don’t need to use a for loop. Instead, use the builtin function meshgrid() which is designed to solve exactly this problem.

    Here’s a tutorial from ‘abbe’ at MIT which details how to create a 3D plot of a function f(x,y) using meshgrid().

    To quote the blurb:

    3D plotting

    When you make a 3-dimensional plot, you usually have a z variable that
    is a function of both x and y. When you want x and y to vary over some
    range, you need a matrix (rather than a vector) for x and y to get a
    complete domain that covers all the different combinations of those x
    and y values over some range. A function called meshgrid will set up x
    and y matrixes like this for you. The x matrix varies the x down rows
    and keeps it constant in columns, and the y matrix varies the y in
    columns and keeps it constant across rows, so you get all combinations
    of x and y if you use the two matrices.

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

Sidebar

Related Questions

I have the following data and am trying to create a barplot in R
I am trying to create a movie from my MATLAB plot. When I call
Trying to create a list to return some JSON data to a view. Following
I am trying to create plot some push pins on map using GeoCoordinate as
I'm trying to create a ggplot2 plot with the legend beneath the plot. The
I am trying to create a Google Map where the user can plot the
I'm trying to plot two sets of data wrt to time on the same
I'm trying to create a procedure which extracts data from a MySQL server (using
I am trying to plot the following equation in MATLAB: ratio = sqrt(1+1/(kr)^2) With
I am trying to create a plot that is annotated with text that contains

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.