📄 psk.m
字号:
h=round(rand(1,10));
hold off;
bit=[];
for n=1:2:length(h)-1;
if h(n)==0 & h(n+1)==1
se=[zeros(1,50) ones(1,50)];
elseif h(n)==0 & h(n+1)==0
se=[zeros(1,50) zeros(1,50)];
elseif h(n)==1 & h(n+1)==0
se=[ones(1,50) zeros(1,50)];
elseif h(n)==1 & h(n+1)==1
se=[ones(1,50) ones(1,50)];
end
bit=[bit se];
end
subplot(311)
t=1/500:1/500:1;
plot(t,bit,'LineWidth',1.5);grid on;
axis([0 1 -1.5 1.5]);
fc=10;
tx=0:0.1/100:1;
a=sin(2*pi*fc*tx);
subplot(312)
plot(tx,a,'LineWidth',1.5);grid on;
n=1;
subplot(313)
while n<=length(h)
if h(n)==0 %0 is -1
tx=(n-1)*0.1:0.1/100:n*0.1;
p=(-1)*sin(2*pi*fc*tx);
plot(tx,p,'LineWidth',1.5);grid on;
hold on;
else
tx=(n-1)*0.1:0.1/100:n*0.1;
p=(1)*sin(2*pi*fc*tx);
plot(tx,p,'LineWidth',1.5);grid on;
hold on;
end
n=n+1;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -