CodeCodeCode

ENGR132: HW02 - c1b_trigfuncplot

Mar 30th, 2011
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.86 KB | None | 0 0
  1. % --- INPUTS ---
  2. angles_rad = (0:0.05:2*pi);             % Angles in radians
  3. % --- CALCULATIONS ---
  4. sin_of_angles = sin(angles_rad);        % Sin of angles
  5. cos_of_angles = cos(angles_rad);        % Cos of angles
  6. % --- OUTPUTS ----
  7. hold;                                   % Toggles plot hold ON
  8. plot(angles_rad,sin_of_angles,'ro--');  % Plots the sine function with circles in red
  9. plot(angles_rad,cos_of_angles,'go--');  % Plots the cosine function with circles in green
  10. xlabel('Angles (radians)');             % Sets plot x-axis to "Angles (radians)"
  11. ylabel('Amplitude');                    % Sets plot y-axis to "Amplitude"
  12. title('Trig Functions');                % Sets plot title to "Trig Functions
  13. legend('Sin','Cos');                    % Creates legend in default upper-left with "Sin" and "Cos"
  14. grid;                                   % Toggles gridlines ON
Advertisement
Add Comment
Please, Sign In to add comment