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

The Archive Base Latest Questions

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

I have a problem which is twofold: How do I plot a toroidal surface

  • 0

I have a problem which is twofold:

  1. How do I plot a toroidal surface in MATLAB, given a major radius R and a minor radius a? To avoid confusion, it is the toroidal/poloidal coordinate system, illustrated in the picture below, that I’m talking about. Toroidal coordinate system

  2. Now, in any point (phi, theta) on this surface, the minor radius will be distorted by some value that I have stored in a matrix. How do I plot this distorted surface? This might be easy once I have the answer to part 1, but this is my actual goal, so any solution to part 1 that cannot handle this is pretty useless to me.

If anyone can tell me how to make the image appear smaller here, please do =)

  • 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-04T06:02:31+00:00Added an answer on June 4, 2026 at 6:02 am

    Addressing your first question: first you will need to define the coordinates of your torus in toroidal coordinates (seems natural!) and then convert to Cartesian coordinates, which is how MATLAB expects all plots to be constructed (unless you are making a polar plot, of course). So we start of by defining our toroidal coordinates:

    aminor = 1.; % Torus minor radius
    Rmajor = 3.; % Torus major radius
    
    theta  = linspace(-pi, pi, 64)   ; % Poloidal angle
    phi    = linspace(0., 2.*pi, 64) ; % Toroidal angle
    

    We just want a single surface of the torus, so the minor radius is a scalar. We now make a 2D mesh of these coordinates:

    [t, p] = meshgrid(phi, theta);
    

    and convert to 3D Cartesian coordinates using the formulas given on the Wikipedia page linked to in the question:

    x = (Rmajor + aminor.*cos(p)) .* cos(t);
    y = (Rmajor + aminor.*cos(p)) .* sin(t);
    z = aminor.*sin(p);
    

    Now we have our torus defined in 3D, we can plot it using surf:

    surf(x, y, z)
    axis equal
    

    Proof!

    Edit: To address your second question, it depends how you have your distortions stored, but say you have a matrix defined at each toroidal and poloidal point, you will just have to multiply the constant that is the minor radius by the distortion. In the following I create a distortion matrix that is the same dimensions as my toroidal and poloidal angle coordinate matrices and that is normally distributed about a mean of 1 with a FWHM of 0.1:

    distortion = 1. + 0.1 * randn(64, 64);
    
    x = (Rmajor + aminor .* distortion .*cos(p)) .* cos(t);
    y = (Rmajor + aminor .* distortion .* cos(p)) .* sin(t);
    z = aminor.* distortion .* sin(p);
    
    surf(x, y, z)
    

    The result of which is:

    enter image description here

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

Sidebar

Related Questions

I have a problem which requires a reversable 1:1 mapping of keys to values.
I have a problem which I cant seem to find answer to through searches
I have a problem which I don't know how to fix. It has to
I have a problem which i can't seem to find the solution to. I
I'm developing an Eclipse plug-in and I have a problem which is reproduced here:
I have a strange problem which I can't fix: A field: private boolean[][][] gaps;
I have a code problem which stems from the fact that I am using
I have an apparently easy problem which is: <div class=container> <div class=a></div> <div class=b></div>
i have a small problem here which i cannot fix,This post goes through but
It looks like a problem which could have simple solution, but I haven't found

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.