draw ellipse and ellipsoid in MATLAB

 How do I draw an ellipse and an ellipsoid using MATLAB? 

 

(x^2/a^2)+(y^2/b^2)=1

 

 n=40;
a=0;   b=2*pi;
c=0;   d=2*pi;
for i=1:n
    u=a+(b-a)*(i-1)/(n-1);
    for j=1:m
        v=a+(d-c)*(j-1)/(m-1);
        x(i,j)=sin(u)*cos(v);
        y(i,j)=sin(u)*sin(v);
        z(i,j)=cos(u);
    end
end
mesh(x,y,z);

But I want the shape?  

NOTE:-


Matlabhelpers.com provide latest MatLab Homework Help,MatLab Assignment Help , SIMULINK APPLICATIONS HELP  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.   

Answers:  

Ellipse article on Wikipedia had a simple JavaScript code to draw ellipses. 

It uses the parametric form: 

 

x(theta) = a0 + ax*sin(theta) + bx*cos(theta)
y(theta) = b0 + ay*sin(theta) + by*cos(theta)

where  

SEE COMPLETE ANSWER CLICK THE LINK 

https://matlabhelpers.com/questions/draw-ellipse-and-ellipsoid-in-matlab.php

Comments

Popular posts from this blog

Why do I get a "Too many input arguments" error when not passing any?

programmingshark

Why Red, Green, Blue channels of image separetely are grayscaled (Matlab)?