Plot a Heart using matlab
105 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Ced
am 11 Mär. 2016
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...
Antworten (2)
Image Analyst
am 12 Mär. 2016
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.
0 Kommentare
Image Analyst
am 11 Mär. 2016
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.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Valentines Day finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!