Question

1. Write an M-file that uses parametric equations to draw the portion of the cylindery21 for 0 < z < 4. Include the following

0 0
Add a comment Improve this question Transcribed image text
Answer #1


Matlab code for creating 3d cylinder clear all close all parametization of x and y %let x-r *cos (the ta); y-r * sin ( the ta

%Matlab code for creating 3d cylinder
clear all
close all

%parametization of x and y
%let x=r*cos(theta); y=r*sin(theta);

%here r= 1; and theta=0 to 2*pi;

%all theta values
theta=linspace(0,2*pi,100); r=1;
x=r*cos(theta); y=r*sin(theta);

%All X and Y and Z
X(1,:)=x; X(2,:)=x;
Y(1,:)=y; Y(2,:)=y;

%Value of z is from 0 to 4
Z(1,:)=zeros(length(x),1);
Z(2,:)=4*ones(length(x),1);

%plotting the cylinder
surf(X,Y,Z)
axis square
xlabel('X')
ylabel('Y')
zlabel('Z')
%title of the graph
title('Plotting of cylinder')

%viewpoint of the plot
v = [5 5 5];
view(v)

%%%%%%%%%%%%%%% End of Code %%%%%%%%%%%%%%%%%

Add a comment
Know the answer?
Add Answer to:
1. Write an M-file that uses parametric equations to draw the portion of the cylindery21 for 0 < z < 4. Include the following in your output: Labels for the three axes. ·Axes set so that the cy...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT