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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:16:02+00:00 2026-06-04T03:16:02+00:00

I am trying to draw 256 small sized squares using MATLAB rectangle function. If

  • 0

I am trying to draw 256 small sized squares using MATLAB rectangle function. If I am drawing abut 10 squares then the following works fine:

for i=1:2:40

rectangle('Position',[5,3+i,0.3,0.3],...
      'Curvature',[0,0],...
     'LineStyle','-', 'faceColor', 'black')

end

axis off; 

daspect([1,1,1])

enter image description here

But when I change the last value of for loop to 512 (to draw 256 squares), it is not printing properly:

enter image description here

Here is the magnified version of a section of the above image:
enter image description here

This image clearly shows some thing is wrong somewhere as the sides of the squares are not perfectly equal and that the squares are becoming smaller in size for higher no. of squares: Can anybody help me draw the squares perfectly with size not diminishing, ? (I don’t have any issues with memory, and I can tolerate multiple pages scrolling down for covering entire squares )

  • 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-04T03:16:03+00:00Added an answer on June 4, 2026 at 3:16 am

    I tried your code and it works fine even when the loop does 512 iterations – when you zoom-in in the final matlab figure. The artifacts you describe are probably caused by the monitor resolution or a low resolution while exporting to non-vector files.

    Try to export your image as a vector file (eps or svg) to see that everything looks fine when you zoom in.

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

Sidebar

Related Questions

When trying to draw the following quads in OpenGL using a vertex array (instead
I am trying to draw a line using the Graphics 2D but then the
I'm trying to draw a polygon using c# and directx All I get is
I am trying to draw a series of rectangles using OpenGL but some of
I'm trying to draw over the whole screen by using the desktop canvas and
I am trying to draw a textured cube using just 8 vertices and one
I am trying to draw a circle using Windows Form at runtime inside a
I'm trying to draw a rectangle on the canvas with the center at the
I'm trying to draw shapes that will move around the screen using the LunarLander
In the following code, I'm trying to draw two lines: One with a subpixel

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.