% C. Talarico % cosine.m clear all; close all; clc; f = 100; % 100 Hz T = 1/f; % 10 ms A = 20e-3; % 20mV t = 0:1e-6:40e-3; wt = 2*pi*f.*t; vin = A*cos(wt); td = 2e-3; wtd = 2*pi*f*td; figure(1); plot(t*1e3, vin*1e3, 'linewidth', 2, 'color', 'b'); xlabel('time [ms]', 'fontsize', 16); ylabel('voltage [mV]','fontsize', 16); ax = gca; set(ax,'Fontsize',14, 'FontName', 'Monospace', 'Fontweight', 'Normal'); t_text = ... '$$ v(t) = \widehat{V} \cdot cos \left( {2 \pi \over T} t \right) = \widehat{V} \cdot cos ( 2 \pi f t ) = \widehat{V} \cdot cos ( \omega t )$$'; title(t_text,'interpreter','latex', ... 'Fontsize', 18, 'fontname', 'monospace'); figure(2); plot(wt, vin*1e3, 'linewidth',2, 'color','m'); xlabel('\omegat [rad]', 'fontsize', 16); ylabel('Voltage [mV]','fontsize', 16); t_text = ... '$$ v(t) = \widehat{V} \cdot cos ( \omega t )$$'; title(t_text,'interpreter','latex', ... 'Fontsize', 18, 'fontname', 'monospace'); xlim([0 8*pi]); ax = gca; set(ax,'Fontsize',16, 'Fontweight', 'Normal'); set(ax, 'xtick', [0, pi, 2*pi, 3*pi, 4*pi, 5*pi, ... 6*pi, 7*pi, 8*pi]) set(ax, 'xtickLabel', {'0', 'p', '2p', '3p','4p', '5p', '6p','7p', ... '8p'}, 'fontname','Symbol'); figure(3); vin = A*cos(wt-wtd); plot(t*1e3, vin*1e3, 'linewidth', 2, 'color', 'g'); xlabel('time [ms]', 'fontsize', 16); ylabel('voltage [mV]','fontsize', 16); ax = gca; set(ax,'Fontsize',14, 'FontName', 'Monospace', 'Fontweight', 'Normal'); t_text = ... '$$ v(t) = \widehat{V} \cdot cos ( \omega t - \omega t_d) = \widehat{V} \cdot cos ( \omega t + \varphi_d)$$'; title(t_text,'interpreter','latex', ... 'Fontsize', 18, 'fontname', 'monospace'); figure(4); plot(wt, vin*1e3, 'linewidth',2, 'color','r'); xlabel('\omegat [rad]', 'fontsize', 16); ylabel('Voltage [mV]','fontsize', 16); t_text = ... '$$ v(t) = \widehat{V} \cdot cos ( \omega t + \varphi_d)$$'; title(t_text,'interpreter','latex', ... 'Fontsize', 18, 'fontname', 'monospace'); xlim([0 8*pi]); ax = gca; set(ax,'Fontsize',16, 'Fontweight', 'Normal'); set(ax, 'xtick', [0, pi, 2*pi, 3*pi, 4*pi, 5*pi, ... 6*pi, 7*pi, 8*pi]) set(ax, 'xtickLabel', {'0', 'p', '2p', '3p','4p', '5p', '6p','7p', ... '8p'}, 'fontname','Symbol');