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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:59:40+00:00 2026-05-23T00:59:40+00:00

X=(-5:.5:5) Z=(-3:.5:3) [x z]=meshgrid(X,Z) The cutoff function that must delete the wanted elements is

  • 0
X=(-5:.5:5)
Z=(-3:.5:3)
[x z]=meshgrid(X,Z)

The cutoff function that must delete the wanted elements is a circle with radius 1
(x-1)^2+(z-1)^2<=1
How can we manage a loop to put those elements 0 in the output data?

  • 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-23T00:59:41+00:00Added an answer on May 23, 2026 at 12:59 am

    I think what you are looking for is this:

    for i=1:size(x,1)
       for j=1:size(x,2)
          if ((x(i,j)-1)^2+(z(i,j)-1)^2<=1)
              x(i,j) = 0;
              y(i,j) = 0;
          end
       end
    end
    

    I hope this code is easy enough for you to understand what it does – if not you should take a programming class somewhere or sit down with a book.

    Now, if the above answer is what you were looking for, take my word for it that gnovice’s answer (a mix of edit 2 and edit 3 actually) showed the way how to do this much smarter in MATLAB:

    radius = 1;
    index = (x-1).^2 + (z-1).^2 <= radius^2;  %# Logical index of elements inside the circle
    x(index) = 0;  %# Set the x values inside the circle to 0
    z(index) = 0;  %# Set the z values inside the circle to 0
    

    Hope this helps – otherwise I’m giving up ;-).

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

Sidebar

Related Questions

I am writing a function to draw an approximate circle on a square array
I have a library function that takes parameters as a text string (it's a
Can somebody tell me what I am doing wrong with the quiver plotting function
I know I can create a 3D surface plot in MATLAB by doing: x
I have an implicit function, for example: f(x,y) = x**y + y**y - 3*x
I am working on an image manipulation problem. I have an overhead projector that
How do I write the following loop using Python's implicit looping? def kl(myA, myB,
I'm working with a quadratic surface f(w0,w1) on MATLAB and I used meshgrid to
Trying to reproduce the problem from this question , I've found I can't plot
i like to use a library or function in C which could perform the

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.