Plot a Heart using matlab

조회 수: 180 (최근 30일)
Gabrielle Mesquita
Gabrielle Mesquita 2016년 3월 11일
답변: Image Analyst 2016년 3월 12일
Cardioid is represented in polar coordinates as r= 2*a (1+ cosb) Write a program that plots a cardioid for a = 2 and b = 0 to 2pi in increments of 0.01. Convert this Cartesian coordinates using the pol2cart function and plot this as x and y. Make it upright (turn). Make the figure window background equal to pink using the following RGB vector: [1 0.6 0.78]. Change the front name on the x-axis to "Arial" and change the font size on the axes to size 20. Make the line curve equal to the same color as the figure window and make the line curve stroke equal to 5. Add a title to the graph that says "I Love MATLAB".
  댓글 수: 1
Ced
Ced 2016년 3월 11일
This is "Matlab Answers", not "Please do my work for me". People are happy to help you if you get stuck somewhere, but you need to show at least a bit of effort.
Besides, you didn't even ask a question...

댓글을 달려면 로그인하십시오.

답변 (2개)

Image Analyst
Image Analyst 2016년 3월 12일
I did it a slightly different way. In case you're interested, here it is:
t = linspace(-pi,pi, 350);
X = t .* sin( pi * .872*sin(t)./t);
Y = -abs(t) .* cos(pi * sin(t)./t);
plot(X,Y);
fill(X, Y, 'r');
axis square;
set(gcf, 'Position', get(0,'Screensize'));
title('Happy Valentines Day', 'FontSize', 28);
You can't use this code because it's not the way your homework instructions asked you to do it, but I thought you might like to see it anyway.

Image Analyst
Image Analyst 2016년 3월 11일
Hint: look up the "colon operator", and the functions xlabel(), ylabel(), title(), pol2cart(). There are options in the label and title functions to change the appearance of the font.

카테고리

Help CenterFile Exchange에서 Valentines Day에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by