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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:18:58+00:00 2026-05-17T21:18:58+00:00

I would like to plot how the amplitude and orientation of a 2D vector

  • 0

I would like to plot how the amplitude and orientation of a 2D vector evolves over time. To do this I would like to create a graph reminiscent of the canonical E & B field graphs you may recall from an introductory electricity and magnetism class.

Specifically, I would like to connect my 2D vector points with a ribbon, so that they are easy to see. Is there a simple way to do this in MATLAB? quiver3 is pretty close, but it lacks the ribbon. Perhaps some sort of parametric surface?

  • 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-17T21:18:59+00:00Added an answer on May 17, 2026 at 9:18 pm

    here’s a solution that draws a ribbon between any two lines in 3D space. you can plot your quiver over it & adjust the opacity using ‘FaceAlpha’ as in gnovice’s solution

    To make the function clearer, I am first posting it without error-checking and resizing functions (which make up most of the body of the function & aren’t particularly interesting)

    function h = filledRibbon (x,y,z,u,v,w,c, varargin)
    %function filledRibbon (x,y,z,u,v,w,c, varargin)
    %
    %plots a ribbon spanning the area between the lines x,y,z and x+u,y+v,z+w
    %in the color c
    %varargin is passed directly to patch
    %returns a handle to the patch graphic created
    
    %make up a set of regions that span the space between the lines
    
    xr = [x(1:end-1); x(1:end-1) + u(1:end-1); x(2:end) + u(2:end); x(2:end)];
    yr = [y(1:end-1); y(1:end-1) + v(1:end-1); y(2:end) + v(2:end); y(2:end)];
    zr = [z(1:end-1); z(1:end-1) + w(1:end-1); z(2:end) + w(2:end); z(2:end)];
    
    %plot the regions with no edges
    h = patch(xr,yr,zr,c, 'LineStyle','none', varargin{:});
    

    use this error-checking version in your actual code:

    function h = filledRibbon (x,y,z,u,v,w,c, varargin)
    %function filledRibbon (x,y,z,u,v,w,c, varargin)
    %
    %plots a ribbon spanning the area between the lines x,y,z and x+u,y+v,z+w
    %in the color c
    %varargin is passed directly to patch
    %returns a handle to the patch graphic created
    
    
    if ~exist('w', 'var') || isempty(w)
        w = 0;
    end
    if ~exist('u', 'var') || isempty(u)
        u = 0;
    end
    if ~exist('v', 'var') || isempty(v)
        v = 0;
    end
    if ~exist('c', 'var') || isempty(c)
        c = 'b';
    end
    
    
    %make all vectors 1xN 
    x = reshape(x,1,[]);
    y = reshape(y,1,[]);
    z = reshape(z,1,[]);
    
    %if any offsets are scalar, expand to a vector
    if all(size(u) == 1)
        u = repmat(u, size(x));
    end
    
    if all(size(v) == 1)
        v = repmat(v, size(x));
    end
    if all(size(w) == 1)
        w = repmat(w, size(x));
    end
    
    %make up a set of regions that span the space between the lines
    
    xr = [x(1:end-1); x(1:end-1) + u(1:end-1); x(2:end) + u(2:end); x(2:end)];
    yr = [y(1:end-1); y(1:end-1) + v(1:end-1); y(2:end) + v(2:end); y(2:end)];
    zr = [z(1:end-1); z(1:end-1) + w(1:end-1); z(2:end) + w(2:end); z(2:end)];
    
    %plot the regions with no edges
    h = patch(xr,yr,zr,c, 'LineStyle','none', varargin{:});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im fairly new to java... i would like to plot a frequency/time graph or
I would like to plot a time series that look like this: what I
I would like to plot a vertical line (I'd prefer any orientation, but I'd
I would like to plot an image at a random position every time the
I would like to plot the shaded region between y=sin(x) and y=0 over x
I would like to plot two functions f1 and f2 on the same graph.
I'm an R/ggplot newbie. I would like to create a geom_line plot of a
I would like to plot this kind of data: X axis: dates Y axis:
I would like to plot discrete values in MATLAB like this: stairs() and stem()
I have a vector of integers, e.g.: 2,8,11,19 . I would like to plot

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.