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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:28:14+00:00 2026-06-05T00:28:14+00:00

Say I have the following script: u = -5:.2:5; [X,Y] = meshgrid(u, u); Z

  • 0

Say I have the following script:

u = -5:.2:5;
[X,Y] = meshgrid(u, u);
Z = cos(X).*cos(Y).*exp(-sqrt(X.^2 + Y.^2)/4);
surf(X,Y,Z);

Is there anyway that I can make MatLab plot only parts of the surface? Say, for instance, I just want to plot a single point, or a single grid, what can I do? I thought perhaps to plot a single point I could use:

surf(X(1,1), Y(1,1), Z(1,1))

But then I get the error message:

??? Error using ==> surf at 78
Data dimensions must agree.

I would really appreciate some input/help here. Thanks in advance 🙂

  • 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-05T00:28:15+00:00Added an answer on June 5, 2026 at 12:28 am

    When I try what you tried, I get the following:

    surf(X(1,1),Y(1,1),Z(1,1))
    Error using surf (line 75) Z must be a matrix, not a scalar or vector.

    So the problem is that you can’t do just a point or line using surf, you’d have to use a different function. But you can select subregions

    >> ii=1:5;
    >> jj=1:20;
    >> surf(X(ii,jj),Y(ii,jj),Z(ii,jj))
    

    Another way to do it is to use NaNs as a mask.

    >> mask = ones(size(X));
    >> mask(1:20, 20:end) = nan;
    >> surf(X.*mask, Y.*mask, Z.*mask)
    

    This will make the parts where NANs are present not be displayed.

    • 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 routes that are constrained to specific subdomains: App::Application.routes.draw do
Say you have the following in files: <script src=../../Public/Javascript/jquery-1.4.1.js type=text/javascript></script> <script src=../../Public/Javascript/jquery.easing-sooper.js type=text/javascript></script> <script
Lets say I have the following code that returns number of anchor elements on
I'm trying to solve the following problem: Say I have a Python script (let's
I have the following problem: I use a script that saves the referer URL.
Let's say I have the following simple script: print ID : ; $ID =
Let's say we have the following mega-simple Python script: print Initializing.... a=10 print Variable
I have the following script: use 5.12.4; use strict; use warnings; say Enter a
Say I have a C++ program that any user can download on their machine.
Let's say I have the following script. This script finds the largest file under

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.