0

Is there a way to make a function I plotted smaller? I have to make this smiley face: 1

I created something that somewhat looks like the mouth and the eyebrows the only problem is it's too big.

2

Is there a way I can make it smaller when plotting? This is my code so far:

x = 0:0.1:2*pi;
y = sin(x);
v = [x(:) y(:)];
for i = 0:0.0555555556:0.5
  figure(1);
  plot(x, y+i);
  %plot(x + 1.5, y+i);
  hold on;
  grid on;
  axis([-0.5 6.5 -4 4.5], "square");
endfor

Thanks!

  • Move the `figure` and `hold on` commands to before the loop, and the `grid on` and `axis` commands to after the loop. You don’t want to do those things for each line you draw, it’ll slow down your code a lot. – Cris Luengo Jan 03 '22 at 15:04
  • To make the drawing smaller, simply increase the size of the drawing area (the `axis` call). – Cris Luengo Jan 03 '22 at 15:05
  • @CrisLuengo if I adjust the drawing size how can I make the mouth bigger than the eyebrows if they are the same function (f(x) = sinx on the segment [0, 2pi])? – SatanasHammer Jan 04 '22 at 09:50

1 Answers1

0

After some experimenting I found that if I write x/2 in plot it will be smaller. plot(x/2, y+i); Thanks for your help!