pid控制 #ifndef _PID_H #ifndef _PID_H #ifdef _PID_C #define PID_EXT #ELSE #define PID_EXT extern #endif typedef struct PID { int SetPoint; unsigned char BitMove; float Proportion; float Integral; float Derivative; int iError; int iIncpid; int LastError; int PrevError; int Uk; }PID,*pPID; PID_EXT PID sPID; PID_EXT pPID sptr; void IncPIDInit(void); int IncPIDCalc(int NextPoint); #endif
上传时间: 2019-08-02
上传用户:stcwzy
nx=length(x(:)); if nargin<2 || isempty(win) win=nx; end if nargin<4 || isempty(m) m=''; end nwin=length(win); if nwin == 1 lw = win; w = ones(1,lw); ELSE lw = nwin; w = win(:)'; end
标签: 能频值
上传时间: 2019-09-23
上传用户:minwenji
# include<stdio.h> # include<math.h> # define N 3 main(){ float NF2(float *x,float *y); float A[N][N]={{10,-1,-2},{-1,10,-2},{-1,-1,5}}; float b[N]={7.2,8.3,4.2},sum=0; float x[N]= {0,0,0},y[N]={0},x0[N]={}; int i,j,n=0; for(i=0;i<N;i++) { x[i]=x0[i]; } for(n=0;;n++){ //计算下一个值 for(i=0;i<N;i++){ sum=0; for(j=0;j<N;j++){ if(j!=i){ sum=sum+A[i][j]*x[j]; } } y[i]=(1/A[i][i])*(b[i]-sum); //sum=0; } //判断误差大小 if(NF2(x,y)>0.01){ for(i=0;i<N;i++){ x[i]=y[i]; } } ELSE break; } printf("经过%d次雅可比迭代解出方程组的解:\n",n+1); for(i=0;i<N;i++){ printf("%f ",y[i]); } } //求两个向量差的二范数函数 float NF2(float *x,float *y){ int i; float z,sum1=0; for(i=0;i<N;i++){ sum1=sum1+pow(y[i]-x[i],2); } z=sqrt(sum1); return z; }
上传时间: 2019-10-13
上传用户:大萌萌撒
以后再也不用担心写爬虫ip被封,不用担心没钱买代理ip的烦恼了 在使用python写爬虫时候,你会遇到所要爬取的网站有反爬取技术比如用同一个IP反复爬取同一个网页,很可能会被封。如何有效的解决这个问题呢?我们可以使用代理ip,来设置代理ip池。 现在教大家一个可获取大量免费有效快速的代理ip方法,我们访问西刺免费代理ip网址 这里面提供了许多代理ip,但是我们尝试过后会发现并不是每一个都是有效的。所以我们现在所要做的就是从里面提供的筛选出有效快速稳定的ip。 以下介绍的免费获取代理ip池的方法: 优点:免费、数量多、有效、速度快 缺点:需要定期筛选 主要思路: 从网址上爬取ip地址并存储 验证ip是否能使用-(随机访问网址判断响应码) 格式化ip地址 代码如下: 1.导入包 import requests from lxml import etree import time 1 2 3 2.获取西刺免费代理ip网址上的代理ip def get_all_proxy(): url = 'http://www.xicidaili.com/nn/1' headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36', } response = requests.get(url, headers=headers) html_ele = etree.HTML(response.text) ip_eles = html_ele.xpath('//table[@id="ip_list"]/tr/td[2]/text()') port_ele = html_ele.xpath('//table[@id="ip_list"]/tr/td[3]/text()') proxy_list = [] for i in range(0,len(ip_eles)): proxy_str = 'http://' + ip_eles[i] + ':' + port_ele[i] proxy_list.append(proxy_str) return proxy_list 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3.验证获取的ip def check_all_proxy(proxy_list): valid_proxy_list = [] for proxy in proxy_list: url = 'http://www.baidu.com/' proxy_dict = { 'http': proxy } try: start_time = time.time() response = requests.get(url, proxies=proxy_dict, timeout=5) if response.status_code == 200: end_time = time.time() print('代理可用:' + proxy) print('耗时:' + str(end_time - start_time)) valid_proxy_list.append(proxy) ELSE: print('代理超时') except: print('代理不可用--------------->'+proxy) return valid_proxy_list 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4.输出获取ip池 if __name__ == '__main__': proxy_list = get_all_proxy() valid_proxy_list = check_all_proxy(proxy_list) print('--'*30) print(valid_proxy_list) 1 2 3 4 5 技术能力有限欢迎提出意见,保证积极向上不断学习 ———————————————— 版权声明:本文为CSDN博主「彬小二」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/qq_39884947/article/details/86609930
上传时间: 2019-11-15
上传用户:fygwz1982
function [R,k,b] = msc(A) % 多元散射校正 % 输入待处理矩阵,通过多元散射校正,求得校正后的矩阵 %% 获得矩阵行列数 [m,n] = size(A); %% 求平均光谱 M = mean(A,2); %% 利用最小二乘法求每一列的斜率k和截距b for i = 1:n a = polyfit(M,A(:,i),1); if i == 1 k = a(1); b = a(2); ELSE k = [k,a(1)]; b = [b,a(2)]; end end %% 求得结果 for i = 1:n Ai = (A(:,i)-b(i))/k(i); if i == 1 R = Ai; ELSE R = [R,Ai]; end end
上传时间: 2020-03-12
上传用户:15275387185
W abooklikethistogether,manypeoplewhoneverhope to see their namesinprint get involved and provide alot of help. I wouldliketogivecreditwherecreditisdueandacknowledgethose people here. Firstandforemost,atleasthalfofthecreditforthisbookneedstogotomy wife,BrigitteKilger-Mattison. Brigittewasresponsible for editingall the mate- rial, creating all the graphics, and coordinating all the efforts of everyone ELSE involvedinthisproject.Thisbookcouldnothavebeencompletedwithouther painstaking attention to detail, her dedication, and her loyalty.
标签: Data Warehousing Mining and
上传时间: 2020-05-27
上传用户:shancjb
Fundamentals of WiMAX was consciously written to appeal to a broad audience, and to be of value to anyone who is interested in the IEEE 802.16e standards or wireless broadband networks more generally. The book contains cutting-edge tutorials on the technical and theoretical under- pinnings to WiMAX that are not available anywhere ELSE, while also providing high-level over- views that will be informative to the casual reader.
标签: Understanding Fundamentals WiMAX of
上传时间: 2020-05-27
上传用户:shancjb
#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
对PL/0作以下修改和扩充,并使用测试用例验证: (1)修改单词:不等号# 改为 != ,只有!符号为非法单词,同时#成为非法 符号。 (2)增加单词(只实现词法分析部分): 保留字 ELSE,FOR,STEP,UNTIL,DO,RETURN 运算符 *=(TIMESBECOMES),/=(SLASHBECOMES),&(AND),||(OR) 注释符 //(NOTE) (3)增加条件语句的ELSE子句(实现语法语义目标代码), 要求:写出相关文法和语法图,分析语义规则的实现。
上传时间: 2020-06-30
上传用户:12345a