% program file lab2009102901.m
clear all;
clf;
tf = 1;
dt = 0.01;
t =0:dt:1;
x1 = cos(2*pi*10*t);
x2 = cos(2*pi*35*t);
fs1 = 2*35;
xc = x1+x2;
ts1 = 1/fs1;
n1 = 0/ts1:1:tf/ts1;
x1_n = cos(2*pi*10*ts1)+cos(2*pi*35*n1*ts1);
subplot(411);
plot(t,x1,'r');
grid;
subplot(412);
plot(t,x2,'g');
grid;
subplot(413);
plot(t,xc,'g');
grid;
subplot(414);
stem(n1,x1_n,'b');
星期四, 10月 29, 2009
matlab 2009 10/29 02
matlab 2009 10 29 01
% program file lab2009102901.m
clear all;
clf;
dt = 0.01;
t =0:dt:5;
x1 = cos(2*pi*10*t);
x2 = cos(2*pi*35*t);
subplot(311);
plot(t,x1,'r');
subplot(312);
plot(t,x2,'g');
subplot(313);
%stem(n,x_n,'b');
星期四, 10月 22, 2009
matlab 2009 10 22 02
% program file lab2009102202.m
clear all;
% clf;
dt = 0.0001;
t =-0.01:dt:0.02;
xc = cos(2*pi*100*t);
tt = 0.0005;
ts = -0.01:tt:0.02;
xd = cos(2*pi*100*ts);
n=-20:1:40;
x4 = cos(2*pi*100*n*tt);
figure(1);
subplot(311);
plot(t,xc);
subplot(312);
stem(ts,xd);
subplot(313);
stem(n,x4);
星期三, 10月 21, 2009
matlab 2009 10 22 01
% program file lab2009102201.m
clear all;
clf;
dt = 0.001;
t =-0:dt:0.1;
s = 5+4*cos(2*pi*20*t);
xc1 = cos(2*pi*200*t);
x1 = s.*xc1;
xc2 = cos(2*pi*700*t);
x2 = s.*xc2;
figure(1);
subplot(311);
plot(t,s,'x');grid;hold on;
plot(t,xc1,'g');
subplot(312);
plot(t,x1);
subplot(313);
plot(t,x2);
星期一, 10月 19, 2009
8051 w2
#pragma oe db pw(80) SM SB CD
#include
#include "Delay.h"
main(){
int num = 0;
char State=0;
P2 =0x3f;
for(;num<6;){
Delay1s();
if(State == 1){
P2 <<= 1;
P2 |=0x01;
}
if(State == 0){
P2 >>= 1;
P2 |=0x80;
}
if((P2&0xc0)==0){//0011 1111 + 1100 0000 =0
State= 0;
num++;
}
if((P2&0x03)==0){
State= 1;
num++;
}
}
for(;;);
}
8051 w2
#pragma oe db pw(80) SM SB CD
#include
#include "Delay.h"
main(){
int num = 0;
char State=0;
P2 =0x3f;
for(;num<6;){
Delay1s();
if(State == 1){
P2 <<= 1;
P2 |=0x01;
}
if(State == 0){
P2 >>= 1;
P2 |=0x80;
}
if((P2&0xc0)==0){//0011 1111 + 1100 0000 =0
State= 0;
num++;
}
if((P2&0x03)==0){
State= 1;
num++;
}
}
for(;;);
}
8051 led2
#pragma oe db pw(80) SM SB CD
#include
void Delay1s(void){ //時間延遲一秒的函數
ACC = 5;
F0 = 1;
F0 = 1;
F0 = 1;
}
main(){
int num = 0; //宣告用來表示次數的變數
char State=0; //宣告檢測右邊和左邊的變數
P0 =0xc0; //初始設定左邊2個點燈是亮的
for(;num<6;){ //來回跑3次的設定
Delay1s(); //時間暫停一秒
if(State == 0) P0 >>= 1; //當電燈到達左邊2個發光時,開始向右邊跑
if(State == 1) P0 <<= 1; //當電燈到達右邊2個發光時,開始向左邊跑
if((P0&0x3f)==0){ //當電燈到達左邊時
State= 0; //檢測變數會改變為 左
num++; //開始算一次
}
if((P0&0xfc)==0){ //當電燈到達右邊
State= 1; //檢測變數會改變為 右
num++; //開始算一次
}
}
for(;;);//讓程式進入無限回圈
}
訂閱:
文章 (Atom)