虫虫首页| 资源下载| 资源专辑| 精品软件
登录| 注册

0.<b>10</b>

  • 汉诺塔!!! Simulate the movement of the Towers of Hanoi puzzle Bonus is possible for using animation

    汉诺塔!!! Simulate the movement of the Towers of Hanoi puzzle Bonus is possible for using animation eg. if n = 2 A→B A→C B→C if n = 3 A→C A→B C→B A→C B→A B→C A→C

    标签: the animation Simulate movement

    上传时间: 2017-02-11

    上传用户:waizhang

  • 离散实验 一个包的传递 用warshall

     实验源代码 //Warshall.cpp #include<stdio.h> void warshall(int k,int n) { int i , j, t; int temp[20][20]; for(int a=0;a<k;a++) { printf("请输入矩阵第%d 行元素:",a); for(int b=0;b<n;b++) { scanf ("%d",&temp[a][b]); } } for(i=0;i<k;i++){ for( j=0;j<k;j++){ if(temp[ j][i]==1) { for(t=0;t<n;t++) { temp[ j][t]=temp[i][t]||temp[ j][t]; } } } } printf("可传递闭包关系矩阵是:\n"); for(i=0;i<k;i++) { for( j=0;j<n;j++) { printf("%d", temp[i][ j]); } printf("\n"); } } void main() { printf("利用 Warshall 算法求二元关系的可传递闭包\n"); void warshall(int,int); int k , n; printf("请输入矩阵的行数 i: "); scanf("%d",&k); 四川大学实验报告 printf("请输入矩阵的列数 j: "); scanf("%d",&n); warshall(k,n); } 

    标签: warshall 离散 实验

    上传时间: 2016-06-27

    上传用户:梁雪文以

  • 模拟 PWM 输出控制灯的 10 个亮度级别

    LED 一般是恒流操作的,如何改变 LED 的亮度呢?答案就是 PWM 控制。在一定的 频率的方波中,调整高电平和低电平的占空比,即可实现。比如我们用低电平点亮一个 LED 灯,我们假设把一个频率周期分为 10 个时间等份,如果方波中的高低电平占空比是 9:1, 这是就是一个比较暗的亮度,如果方波中高低电平占空比是 10:0,这时,全部是高电平, 灯是灭的。如果占空比是 5:5,就是一个中间亮度,如果高低比是 1:9,是一个比较亮的 亮度,如果高低是 0:10,这时全部是低电平,就是最亮的。  实际上应用中,电视屏幕墙中的几十百万 LED 象素都是这样控制的,而且每一个象素 都有红绿蓝 3 个 LED,每个 LED 可以变化的亮度是几百到几万或者更多的级别,以实现真 彩色的显示。还有在您的手机中,背光灯的亮度如果是可以变化的,也应该是这种工作方式。 目前的城市彩灯也有很多都使用了 LED,需要控制亮度是也是 PWM 控制。  下面来分析我们的例程,在这个例程中,我们将定时器 2 溢出定为 1/1200 秒。每 10 次脉冲输出一个 120HZ 频率。这每 10 次脉冲再用来控制高低电平的 10 个比值。这样,在 每个 1/120 秒的方波周期中,我们都可以改变方波的输出占空比,从而控制 LED 灯的 10 个 级别的亮度。  为什么输出方波的频率要 120HZ 这么高?因为如果频率太低,人眼就会看到闪烁感 觉。一般起码要在 60HZ 以上才感觉好点,120HZ 就基本上看不到闪烁,只能看到亮度的变 化了。  下面请看程序,程序中有比较多的注释:  ―――――――――――――――――――――――  #define uchar unsigned char //定义一下方便使用  #define uint unsigned int  #define ulong unsigned long  #include <reg52.h> //包括一个 52 标准内核的头文件    sbit P10 = P1^0; //要控制的 LED 灯  sbit K1= P3^2; //按键 K1    uchar scale;//用于保存占空比的输出 0 的时间份额,总共 10 份    char code dx516[3] _at_ 0x003b;//这是为了仿真设置的  //模拟 PWM 输出控制灯的 10 个亮度级别  void main(void) // 主程序  {   uint n;     RCAP2H =0xF3; //赋 T2 的预置值,溢出 1 次是 1/1200 秒钟   RCAP2L =0x98;   TR2=1; //启动定时器   ET2=1; //打开定时器 2 中断   EA=1; //打开总中断   while(1) //程序循环   { ;//主程序在这里就不断自循环,实际应用中,这里是做主要工作   for(n=0;n<50000;n++); //每过一会儿就自动加一个档次的亮度   scale++;   if(scale==10)scale=0;   }  }  //1/1200 秒定时器 2 中断  timer2() interrupt 5  {   static uchar tt; //tt 用来保存当前时间在一秒中的比例位置   TF2=0;     tt++;   if(tt==10) //每 1/120 秒整开始输出低电平   {   tt=0;     if(scale!=0) //这里加这一句是为了消除灭灯状态产生的鬼影   P10=0;   }     if(scale==tt) //按照当前占空比切换输出高电平   P10=1;    }  ――――――――――――――――――  在主程序中,每延时一段时间,就自动换一个占空比,以使亮度自动变化,方便观察。  编译,运行,看结果。  可以看到,LED 的亮度以每种亮度 1 秒左右不断变化,共有 10 个级别。

    标签: PWM 10 模拟 控制灯 亮度 输出

    上传时间: 2017-11-06

    上传用户:szcyclone

  • 道理特分解法

    #include "iostream" using namespace std; class Matrix { private: double** A; //矩阵A double *b; //向量b public: int size; Matrix(int ); ~Matrix(); friend double* Dooli(Matrix& ); void Input(); void Disp(); }; Matrix::Matrix(int x) { size=x; //为向量b分配空间并初始化为0 b=new double [x]; for(int j=0;j<x;j++) b[j]=0; //为向量A分配空间并初始化为0 A=new double* [x]; for(int i=0;i<x;i++) A[i]=new double [x]; for(int m=0;m<x;m++) for(int n=0;n<x;n++) A[m][n]=0; } Matrix::~Matrix() { cout<<"正在析构中~~~~"<<endl; delete b; for(int i=0;i<size;i++) delete A[i]; delete A; } void Matrix::Disp() { for(int i=0;i<size;i++) { for(int j=0;j<size;j++) cout<<A[i][j]<<" "; cout<<endl; } } void Matrix::Input() { cout<<"请输入A:"<<endl; for(int i=0;i<size;i++) for(int j=0;j<size;j++){ cout<<"第"<<i+1<<"行"<<"第"<<j+1<<"列:"<<endl; cin>>A[i][j]; } cout<<"请输入b:"<<endl; for(int j=0;j<size;j++){ cout<<"第"<<j+1<<"个:"<<endl; cin>>b[j]; } } double* Dooli(Matrix& A) { double *Xn=new double [A.size]; Matrix L(A.size),U(A.size); //分别求得U,L的第一行与第一列 for(int i=0;i<A.size;i++) U.A[0][i]=A.A[0][i]; for(int j=1;j<A.size;j++) L.A[j][0]=A.A[j][0]/U.A[0][0]; //分别求得U,L的第r行,第r列 double temp1=0,temp2=0; for(int r=1;r<A.size;r++){ //U for(int i=r;i<A.size;i++){ for(int k=0;k<r-1;k++) temp1=temp1+L.A[r][k]*U.A[k][i]; U.A[r][i]=A.A[r][i]-temp1; } //L for(int i=r+1;i<A.size;i++){ for(int k=0;k<r-1;k++) temp2=temp2+L.A[i][k]*U.A[k][r]; L.A[i][r]=(A.A[i][r]-temp2)/U.A[r][r]; } } cout<<"计算U得:"<<endl; U.Disp(); cout<<"计算L的:"<<endl; L.Disp(); double *Y=new double [A.size]; Y[0]=A.b[0]; for(int i=1;i<A.size;i++ ){ double temp3=0; for(int k=0;k<i-1;k++) temp3=temp3+L.A[i][k]*Y[k]; Y[i]=A.b[i]-temp3; } Xn[A.size-1]=Y[A.size-1]/U.A[A.size-1][A.size-1]; for(int i=A.size-1;i>=0;i--){ double temp4=0; for(int k=i+1;k<A.size;k++) temp4=temp4+U.A[i][k]*Xn[k]; Xn[i]=(Y[i]-temp4)/U.A[i][i]; } return Xn; } int main() { Matrix B(4); B.Input(); double *X; X=Dooli(B); cout<<"~~~~解得:"<<endl; for(int i=0;i<B.size;i++) cout<<"X["<<i<<"]:"<<X[i]<<" "; cout<<endl<<"呵呵呵呵呵"; return 0; } 

    标签: 道理特分解法

    上传时间: 2018-05-20

    上传用户:Aa123456789

  • matlab通信仿真psk误码分析

    MATLAB仿真通信PSK误码分析,主要用来测试SNR从0到10时的系统性能-MATLAB simulation PSK communication error analysis

    标签: matlab psk 通信 仿真

    上传时间: 2013-04-24

    上传用户:924484786

  • 基于相关分析的飞机目标识别方法

    提出了一种基于相关分析的飞机目标识别方法。该方法利用飞机图像低频和高频部分合成滤波器模板,能达到很高识别率与很低的等错率。该研究旨在提高飞机识别的准确率和降低出错率,采用一种基于相关分析的飞机目标识别方法。该方法通过对采集的飞机图像做去除背景、降噪、图像增强、二值化和归一化处理,将飞机图像低频和高频部分合成滤波器模板,通过特征比对达到识别飞机的目的。利用Matlab 7.0做10种飞机的识别实验,得出了95.47%识别率和0.04%等错率的结论,识别率和等错率均优于不变矩法、三维识别方法、基于小波分析和矩不变量的方法,印证了笔者提出的基于相关分析的飞机目标识别方法的优越性。在飞机图像数据库上的实验结果表明,该方法是可行的。

    标签: 飞机 目标识别

    上传时间: 2013-11-03

    上传用户:manlian

  • 微电脑型盘面式精密直流毫安电流,直流电压,频率(脉波)标准产生器

    特点 精确度0.05%滿刻度 可显示与产生精密直流毫安電流,直流电压,頻率(脈波) 可模擬90度相位差脈波输出功能 高解析度类比输出功能(15bit DAC) 类比输出范围0至20.000毫安培(0至10.000伏特) 宽范围频率输出功能10Hz至4KHz 宽范围脈波输出功能1至10000個 尺寸小,稳定性高

    标签: 微电脑 产生器 精密直流 电流

    上传时间: 2013-11-03

    上传用户:yy_cn

  • 题目:利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A表示

    题目:利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A表示,60-89分之间的用B表示,60分以下的用C表示。 1.程序分析:(a>b)?a:b这是条件运算符的基本例子。

    标签: gt 90 运算符 嵌套

    上传时间: 2015-01-08

    上传用户:lifangyuan12

  • 源代码用动态规划算法计算序列关系个数 用关系"<"和"="将3个数a

    源代码\用动态规划算法计算序列关系个数 用关系"<"和"="将3个数a,b,c依次序排列时,有13种不同的序列关系: a=b=c,a=b<c,a<b=v,a<b<c,a<c<b a=c<b,b<a=c,b<a<c,b<c<a,b=c<a c<a=b,c<a<b,c<b<a 若要将n个数依序列,设计一个动态规划算法,计算出有多少种不同的序列关系, 要求算法只占用O(n),只耗时O(n*n).

    标签: lt 源代码 动态规划 序列

    上传时间: 2013-12-26

    上传用户:siguazgb

  • The government of a small but important country has decided that the alphabet needs to be streamline

    The government of a small but important country has decided that the alphabet needs to be streamlined and reordered. Uppercase letters will be eliminated. They will issue a royal decree in the form of a String of B and A characters. The first character in the decree specifies whether a must come ( B )Before b in the new alphabet or ( A )After b . The second character determines the relative placement of b and c , etc. So, for example, "BAA" means that a must come Before b , b must come After c , and c must come After d . Any letters beyond these requirements are to be excluded, so if the decree specifies k comparisons then the new alphabet will contain the first k+1 lowercase letters of the current alphabet. Create a class Alphabet that contains the method choices that takes the decree as input and returns the number of possible new alphabets that conform to the decree. If more than 1,000,000,000 are possible, return -1. Definition

    标签: government streamline important alphabet

    上传时间: 2015-06-09

    上传用户:weixiao99