Plot a Heart using matlab

97 次查看(过去 30 天)
Gabrielle Mesquita
Gabrielle Mesquita 2016-3-11
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