RC Bode Plots

			
				% RC filter bode plots
				R = 1e3; % 1K
				C = 1e-6; % 1uF

				% G = (1/jwC)/(1/jwC+R) = 1/(jwRC+1) = 1/(sRC+1) low-pass
				G_LP = tf(1,[R*C 1]); % low-pass

				% G = R/(1/jwC+R) = jwRC/(jwRC+1) = RC/(sRC+1) high-pass
				G_HP = tf([R*C 0],[R*C 1]); % high-pass

				close all;

				figure;
				opts = bodeoptions('cstprefs'); % custom options
				opts.Title.String = 'Low-Pass'; % title
				L = bodeplot(G_LP, opts); % bode plot
				setoptions(L,'FreqUnits','Hz'); % change x-axis to Hz from rad/s
				grid on;

				figure;
				opts = bodeoptions('cstprefs');
				opts.Title.String = 'High-Pass';
				H = bodeplot(G_HP, opts);
				setoptions(H,'FreqUnits','Hz');
				grid on;
			
		
© 2018 Copyright. For individual use only. No liability is accepted for any consequences of using information on Testips.com.