function y=lagr(x0,y0,x) %x0,y0为节点 %x是插值点 n=length(x0); m=length(x); for i=1:m z=x(i); s=0.0; for k=1:n p=1.0; for j=1:n if j~=k p=p*(z-x0(j))/(x0(k)-x0(j)); end end s=p*y0(k)+s; end y(i)=s; end
标签: lagr
上传时间: 2020-06-09
上传用户:shiyc2020
#include<stdio.h> #define TREEMAX 100 typedef struct BT { char data; BT *lchild; BT *rchild; }BT; BT *CreateTree(); void Preorder(BT *T); void Postorder(BT *T); void Inorder(BT *T); void Leafnum(BT *T); void Nodenum(BT *T); int TreeDepth(BT *T); int count=0; void main() { BT *T=NULL; char ch1,ch2,a; ch1='y'; while(ch1=='y'||ch1=='y') { printf("\n"); printf("\n\t\t 二叉树子系统"); printf("\n\t\t*****************************************"); printf("\n\t\t 1---------建二叉树 "); printf("\n\t\t 2---------先序遍历 "); printf("\n\t\t 3---------中序遍历 "); printf("\n\t\t 4---------后序遍历 "); printf("\n\t\t 5---------求叶子数 "); printf("\n\t\t 6---------求结点数 "); printf("\n\t\t 7---------求树深度 "); printf("\n\t\t 0---------返 回 "); printf("\n\t\t*****************************************"); printf("\n\t\t 请选择菜单号 (0--7)"); scanf("%c",&ch2); getchar(); printf("\n"); switch(ch2) { case'1': printf("\n\t\t请按先序序列输入二叉树的结点:\n"); printf("\n\t\t说明:输入结点(‘0’代表后继结点为空)后按回车。\n"); printf("\n\t\t请输入根结点:"); T=CreateTree(); printf("\n\t\t二叉树成功建立!\n");break; case'2': printf("\n\t\t该二叉树的先序遍历序列为:"); Preorder(T);break; case'3': printf("\n\t\t该二叉树的中序遍历序列为:"); Inorder(T);break; case'4': printf("\n\t\t该二叉树的后序遍历序列为:"); Postorder(T);break; case'5': count=0;Leafnum(T); printf("\n\t\t该二叉树有%d个叶子。\n",count);break; case'6': count=0;Nodenum(T); printf("\n\t\t该二叉树总共有%d个结点。\n",count);break; case'7': printf("\n\t\t该树的深度为:%d",TreeDepth(T)); break; case'0': ch1='n';break; default: printf("\n\t\t***请注意:输入有误!***"); } if(ch2!='0') { printf("\n\n\t\t按【Enter】键继续,按任意键返回主菜单!\n"); a=getchar(); if(a!='\xA') { getchar(); ch1='n'; } } } } BT *CreateTree() { BT *t; char x; scanf("%c",&x); getchar(); if(x=='0') t=NULL; else { t=new BT; t->data=x; printf("\n\t\t请输入%c结点的左子结点:",t->data); t->lchild=CreateTree(); printf("\n\t\t请输入%c结点的右子结点:",t->data); t->rchild=CreateTree(); } return t; } void Preorder(BT *T) { if(T) { printf("%3c",T->data); Preorder(T->lchild); Preorder(T->rchild); } } void Inorder(BT *T) { if(T) { Inorder(T->lchild); printf("%3c",T->data); Inorder(T->rchild); } } void Postorder(BT *T) { if(T) { Postorder(T->lchild); Postorder(T->rchild); printf("%3c",T->data); } } void Leafnum(BT *T) { if(T) { if(T->lchild==NULL&&T->rchild==NULL) count++; Leafnum(T->lchild); Leafnum(T->rchild); } } void Nodenum(BT *T) { if(T) { count++; Nodenum(T->lchild); Nodenum(T->rchild); } } int TreeDepth(BT *T) { int ldep,rdep; if(T==NULL) return 0; else { ldep=TreeDepth(T->lchild); rdep=TreeDepth(T->rchild); if(ldep>rdep) return ldep+1; else return rdep+1; } }
上传时间: 2020-06-11
上传用户:ccccy
#include <stdio.h> #include <stdlib.h> #define SMAX 100 typedef struct SPNode { int i,j,v; }SPNode; struct sparmatrix { int rows,cols,terms; SPNode data [SMAX]; }; sparmatrix CreateSparmatrix() { sparmatrix A; printf("\n\t\t请输入稀疏矩阵的行数,列数和非零元素个数(用逗号隔开):"); scanf("%d,%d,%d",&A.cols,&A.terms); for(int n=0;n<=A.terms-1;n++) { printf("\n\t\t输入非零元素值(格式:行号,列号,值):"); scanf("%d,%d,%d",&A.data[n].i,&A.data[n].j,&A.data[n].v); } return A; } void ShowSparmatrix(sparmatrix A) { int k; printf("\n\t\t"); for(int x=0;x<=A.rows-1;x++) { for(int y=0;y<=A.cols-1;y++) { k=0; for(int n=0;n<=A.terms-1;n++) { if((A.data[n].i-1==x)&&(A.data[n].j-1==y)) { printf("%8d",A.data[n].v); k=1; } } if(k==0) printf("%8d",k); } printf("\n\t\t"); } } void sumsparmatrix(sparmatrix A) { SPNode *p; p=(SPNode*)malloc(sizeof(SPNode)); p->v=0; int k; k=0; printf("\n\t\t"); for(int x=0;x<=A.rows-1;x++) { for(int y=0;y<=A.cols-1;y++) { for(int n=0;n<=A.terms;n++) { if((A.data[n].i==x)&&(A.data[n].j==y)&&(x==y)) { p->v=p->v+A.data[n].v; k=1; } } } printf("\n\t\t"); } if(k==1) printf("\n\t\t对角线元素的和::%d\n",p->v); else printf("\n\t\t对角线元素的和为::0"); } int main() { int ch=1,choice; struct sparmatrix A; A.terms=0; while(ch) { printf("\n"); printf("\n\t\t 稀疏矩阵的三元组系统 "); printf("\n\t\t*********************************"); printf("\n\t\t 1------------创建 "); printf("\n\t\t 2------------显示 "); printf("\n\t\t 3------------求对角线元素和"); printf("\n\t\t 4------------返回 "); printf("\n\t\t*********************************"); printf("\n\t\t请选择菜单号(0-3):"); scanf("%d",&choice); switch(choice) { case 1: A=CreateSparmatrix(); break; case 2: ShowSparmatrix(A); break; case 3: SumSparmatrix(A); break; default: system("cls"); printf("\n\t\t输入错误!请重新输入!\n"); break; } if (choice==1||choice==2||choice==3) { printf("\n\t\t"); system("pause"); system("cls"); } else system("cls"); } }
上传时间: 2020-06-11
上传用户:ccccy
Agilent 34401A Service Guide.pdfIEC Measurement Category II includes electrical devices connected to mains at an outlet on a branch circuit. Such devices include most small appliances, test equipment, and other devices that plug into a branch outlet or socket. The 34401A may be used to make measurements with the HI and LO inputs connected to mains in such devices, or to the branch outlet itself (up to 300 VAC). However, the 34401A may not be used with its HI and LO inputs connected to mains in permanently installed electrical devices such as the main circuit-breaker panel, sub-panel disconnect boxes, or permanently wired motors. Such devices and circuits are subject to overvoltages that may exceed the protection limits of the 34401A. Note: Voltages above 300 VAC may be measured only in circuits that are isolated from mains. However, transient overvoltages are also present on circuits that are isolated from mains. The Agilent 34401A are designed to safely withstand occasional transient overvoltages up to 2500 Vpk. Do not use this equipment to measure circuits where transient overvoltages could exceed this level. Additional Notices Waste Electrical and Electronic Equipment (WEEE) Directive 2002/96/EC This product complies with the WEEE Directive (2002/96/EC) marking requirement. The affixed product label (see below) indicates that you must not discard this electrical/electronic product in domestic household waste. Product Category: With reference to the equipment types in the WEEE directive Annex 1, this product is classified as a "Monitoring and Control instrumentation" product. Do not dispose in domestic household waste. To return unwanted products, contact your local Agilent office, or see www.agilent.com/environment/product for more information. Agilent 34138A Test Lead Set The Agilent 34401A is compatible with the Agilent 34138A Test Lead Set described below. Test Lead Ratings Test Leads - 1000V, 15A Fine Tip Probe Attachments - 300V, 3A Mini Grabber Attachment - 300V, 3A SMT Grabber Attachments - 300V, 3A Operation The Fine Tip, Mini Grabber, and SMT Grabber attachments plug onto the probe end of the Test Leads. Maintenance If any portion of the Test Lead Set is worn or damaged, do not use. Replace with a new Agilent 3413
标签: agilent
上传时间: 2022-02-20
上传用户:
电子书-RTL Design Style Guide for Verilog HDL540页A FF having a fixed input value is generated from the description in the upper portion of Example 2-21. In this case, ’0’ is output when the reset signal is asynchronously input, and ’1’ is output when the START signal rises. Therefore, the FF data input is fixed at the power supply, since the typical value ’1’ is output following the rise of the START signal. When FF input values are fixed, the fixed inputs become untestable and the fault detection rate drops. When implementing a scan design and converting to a scan FF, the scan may not be executed properl not be executed properly, so such descriptions , so such descriptions are not are not recommended. recommended.[1] As in the lower part of Example 2-21, be sure to construct a synchronous type of circuit and ensure that the clock signal is input to the clock pin of the FF. Other than the sample shown in Example 2-21, there are situations where for certain control signals, those that had been switched due to the conditions of an external input will no longer need to be switched, leaving only a FF. If logic exists in a lower level and a fixed value is input from an upper level, the input value of the FF may also end up being fixed as the result of optimization with logic synthesis tools. In a situation like this, while perhaps difficult to completely eliminate, the problem should be avoided as much as possible.
标签: RTL verilog hdl
上传时间: 2022-03-21
上传用户:canderile
为了提高超高频RFID系统中阅读器在低信噪比的情况下仍具有较高的识别能力,提出一种基于FPGA系统结合软件无线电方法实现超高频RFID射频前端电路方案。超高频射频识别系统必须符合EPC Class 1generation 2标准,所设计的电路系统以Xilinx公司的XC6SLX16-2CSG324FPGA芯片为硬件基础,将数字基带调制解调和中频滤波电路在FPGA系统中设计实现,重点阐述了射频前端电路的设计结构、AD/DA转换电路,以及数字滤波器的设计。实验结果表明,所设计的超高频RFID阅读器简化了前端电路系统结构,提升了稳定性,增强了抗干扰能力。该电路系统在信噪比较低的情况下,能够较好地实现915MHz频率的射频接收和发送。In order to improve the reader UHF RFID system still has a higher ability to identify,in the case of low signal-to-noise ratio.The UHF RFID systems must comply with EPC Class 1 generation 2 standard.In this paper,the design of the circuit system based on Xilinx's XC6SLX16-2CSG324 FPGA chip,and presents UHF RFID RF front-end circuit with software radio based on FPGA system.Digital baseband modem and IF filter circuit is designed and implemented in the FPGA system,and focused on designing the structure of the RF front-end circuit,AD/DA conversion circuits,and digital filter.Experimental results show that the UHF RFID reader de...
标签: 915mhz 超高频 rfid 阅读 射频 前端 电路 设计
上传时间: 2022-04-17
上传用户:shjgzh
STM32F103开发板 DHT11温湿度DS18B20 气体MQ-2光敏声控雨滴传感器实验程序**--------------------------------------------------------------------------------------------------------** Created by: FiYu** Created date: 2015-12-12** Version: 1.0** Descriptions: DHT11温湿度传感器实验 **--------------------------------------------------------------------------------------------------------** Modified by: FiYu** Modified date: ** Version: ** Descriptions: ** Rechecked by: **********************************************************************************************************/#include "stm32f10x.h"#include "delay.h"#include "dht11.h"#include "usart.h"DHT11_Data_TypeDef DHT11_Data;/************************************************************************************** * 描 述 : GPIO/USART1初始化配置 * 入 参 : 无 * 返回值 : 无 **************************************************************************************/void GPIO_Configuration(void){ GPIO_InitTypeDef GPIO_InitStructure; /* Enable the GPIO_LED Clock */ RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO , ENABLE); GPIO_DeInit(GPIOB); //将外设GPIOA寄存器重设为缺省值 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //推挽输出 GPIO_Init(GPIOB, &GPIO_InitStructure); GPIO_DeInit(GPIOA); //将外设GPIOA寄存器重设为缺省值 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; //推挽输出 GPIO_Init(GPIOA, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; //浮空输入 GPIO_Init(GPIOA, &GPIO_InitStructure); GPIO_SetBits(GPIOB , GPIO_Pin_9); //初始状态,熄灭指示灯LED1}/************************************************************************************** * 描 述 : 串口显示实时温湿度 * 入 参 : 无 * 返回值 : 无 **************************************************************************************/void DHT11_SCAN(void){ if( Read_DHT11(&DHT11_Data)==SUCCESS) { printf("\r\n读取DHT11成功!\r\n\r\n湿度为%d.%d %RH ,温度为 %d.%d℃ \r\n",\ DHT11_Data.humi_int,DHT11_Data.humi_deci,DHT11_Data.temp_int,DHT11_Data.temp_deci); //printf("\r\n 湿度:%d,温度:%d \r\n" ,DHT11_Data.humi_int,DHT11_Data.temp_int); } else { printf("Read DHT11 ERROR!\r\n"); }}/************************************************************************************** * 描 述 : MAIN函数 * 入 参 : 无 * 返回值 : 无 **************************************************************************************/int main(void){ SystemInit(); //设置系统时钟72MHZ GPIO_Configuration(); USART1_Init(); //初始化配置TIM DHT11_GPIO_Config(); // 初始化温湿度传感器PB1引脚初始时为推挽输出 GPIO_ResetBits(GPIOB , GPIO_Pin_9); delay_ms(500); while(1) { GPIO_SetBits(GPIOB , GPIO_Pin_9); DHT11_SCAN(); //实时显示温湿度 delay_ms(1500); } }
上传时间: 2022-05-03
上传用户:得之我幸78
基于STC89C51单片机的智能电热水器的控制器的设计,要达到的控制要求有:(1)用LCD1602液晶显示水温、设置上下限和定时时间,(2)水温检测显示范围为00~99℃,精度为±1℃。(3)温度预设范围为0~99℃,当检测温度低于预设温度时,开始加热;检测温度高于预设温度时,停止加热。(4)设置4个程序按键。分别问设置按键、加键、减键、确定。(5)可以红外遥控,通过红外一体接收探头接收遥控器信号,执行与主板按键同等功能。(6)有水位检测功能,无水自动上水,无水不加热。//外部中断解码程序_外部中断0void intersvr1(void) interrupt 2 using 1{ TR0=1; Tc=TH0*256+TL0;//提取中断时间间隔时长 TH0=0; TL0=0; //定时中断重新置零 if((Tc>Imin)&&(Tc<Imax)) { m=0; f=1; return; } //找到启始码 if(f==1) { if(Tc>Inum1&&Tc<Inum3) { Im[m/8]=Im[m/8]>>1|0x80; m++; } if(Tc>Inum2&&Tc<Inum1) { Im[m/8]=Im[m/8]>>1; m++; //取码 } if(m==32) { m=0; f=0; if(Im[2]==~Im[3]) { IrOK=1; TR0=0; } else IrOK=0; //取码完成后判断读码是否正确 } //准备读下一码 }}
上传时间: 2022-05-14
上传用户:
PID-小车类-手机遥控十分mimi蓝牙小车V2资料全部开源/**************************************************************************函数功能:增量PI控制器入口参数:编码器测量值,目标速度返回 值:电机PWM根据增量式离散PID公式 pwm+=Kp[e(k)-e(k-1)]+Ki*e(k)+Kd[e(k)-2e(k-1)+e(k-2)]e(k)代表本次偏差 e(k-1)代表上一次的偏差 以此类推 pwm代表增量输出在我们的速度控制闭环系统里面,只使用PI控制pwm+=Kp[e(k)-e(k-1)]+Ki*e(k)**************************************************************************/int Speed_Incremental_PI (int Encoder,int Target){ static int Bias,Pwm,Last_bias; Bias=Encoder-Target; //计算偏差 Pwm+=Speed_Kp*(Bias-Last_bias)+Speed_Ki*Bias; //增量式PI控制器if(Pwm>500)Pwm=500;else if(Pwm<-500)Pwm=-500; Last_bias=Bias; //保存上一次偏差 return Pwm; //增量输出}
上传时间: 2022-06-01
上传用户:20125101110
应广单片机 MINI-C编程指南.Mini-c总结文档一、缺点:(一)函数不能带参数.解决方法:通过A或全局变量进行参数传递;(二)不能使用for循环解决方法:用while循环代替for循环.(三)数组和指针功能弱化解决方法:① 使用rom查表② 使用ram查表(四)不支持全局变量定义同时进行初始化解决方法: 在初始化的时候记得对全局变量进行初始化. (五)Bit变量只支持写入0,或1,不支持直接bit变量取反解决方法 :if(uBitFlag){ uBitFlag=0;}Else{ uBitFlag=1; } 二、优点:(一)函数不带参数,可以节省堆栈空间(二)支持ROM查表(三).delay时间非常准确,无需手工计算(四)支持bit变量,节省ram空间,支持字,字节拆分.(五)烧录支持滚动码写入.(六)端口配置可以使用脚本(七) 代码自动生成
标签: 单片机
上传时间: 2022-06-17
上传用户: