Created
June 8, 2017 05:55
-
-
Save a46554/1c8f4ce55a8d72db5030d5b3d59c7565 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clc; | |
clear; | |
sample_bits = 12;#smaple bits | |
fs = 10000; #sample frequency | |
f = 60; #target frequency | |
amp= 2^(sample_bits-1); | |
t = 0:1/fs:1/f; | |
x = amp*(1+sin(2*pi*f*t));#avoid negative part | |
pwm_duty = x/(amp*2); | |
bar (pwm_duty); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment