代码搜索结果
找到约 10,000 项符合
Raspberry Pi 的代码
pizza.c
/* pizza.c -- uses defined constants in a pizza context */
#include
#define PI 3.14159
int main(void)
{
float area, circum, radius;
printf("What is the radius of your pizza?\
gngauss.m
function[gsrv1,gsrv2]=gngauss(m,sgma)
if nargin==0,
m=0;sgma=1;
elseif nargin==1,
sgma=m;m=0;
end;
u=rand;
z=sgma*(sqrt(2*log(1/(1-u))));
u=rand;
gsrv1=m+z*cos(2*pi*u);
gsrv2=m+z*sin
gngauss.m
function[gsrv1,gsrv2]=gngauss(m,sgma)
if nargin==0,
m=0;sgma=1;
elseif nargin==1,
sgma=m;m=0;
end;
u=rand;
z=sgma*(sqrt(2*log(1/(1-u))));
u=rand;
gsrv1=m+z*cos(2*pi*u);
gsrv2=m
4-7.txt
/* 范例:4-7 */
#include
#include
void main()
{
char name[20];
char sex;
int age;
float pi;
printf("请输入您的姓名:");
scanf("%s",name); /* #1 */
printf("请输入您的性别(
dft.m
function [Xk]=dft(xn,N)
%计算离散傅立叶变换
%Xk为在0
m0709.m
clear
N=100;
n=0:N-1;
xn=cos(0.5*pi*n)+sin(0.6*pi*n);
Xk=dft(xn,N)
subplot(2,1,1)
plot(n,xn)
ylabel('x(n)')
subplot(2,1,2)
k=0:length(abs(Xk))-1;
plot(k,abs(Xk));
ylabel('|X(k)|')
demosubplot.m
% demoSubplot Demonstration of subplot with four sine functions
x = linspace(0,2*pi);
subplot(2,2,1);
plot(x,sin(x)); axis([0 2*pi -1.5 1.5]); title('sin(x)');
subplot(2,2,2);
plot(x,s
m06_amod_qam.m
fs=100; %采样频率
fc=15; %载波频率
t=0:0.025:2; %采样时间
x=sin([pi*t',2*pi*t']); %信号
y = amod(x, fc, fs,'qam'); %正交幅度调制
z = ademod(y, fc, fs, 'qam');%正交幅度解调
plot(t,x,'-',t,z,'.') %绘制调
m06_quantiz.m
N=2^3; %以3比特传输信道
t=[0:100]*pi/20;
u=cos(t);
[p,c]=lloyds(u,N);
[index,quant,distor]=quantiz(u,p,c);
plot(t,u,t,quant,'*');
quant=c(index+1)
equaltest.m
% Script to demonstrate equality of two floating point numbers
x = tan(pi/6);
y = sin(pi/6)/cos(pi/6);
if x==y
fprintf('x and y are equal\n');
else
fprintf('x and y are not equal: x = %e