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
My association with the theory of controls in continuous time started during my studies at the Indian Institute of Technology, Kharagpur, India, in 1974 as an undergraduate student in the Controls and Power program. The initial introduction by Professors Kesavamurthy, Y. P. Singh, and Rajagopalan laid the foundation for a good basic understanding of the subject matter. This pursuit and further advanced study in the field of digital controls continued during my days as a graduate student in the Electrical and Systems Engineering Department at the University of Connecticut in Storrs, from 1983 to 1988.
標簽: Applications Digital Control
上傳時間: 2020-06-10
上傳用戶: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
某疾病發生率y‰和年齡段x(每五年為一段,例如0~5歲為第一段..)
標簽: C代碼
上傳時間: 2020-06-14
上傳用戶:ll12346
第一種邊界條件下的三次樣條插值問題(高斯消元法) 題目 計算方法上機實習題目(二) ——第一種邊界條件下的三次樣條插值問題(高斯消元法) 已知直升飛機旋轉機翼外形曲線輪廓線上的某些型值點(見表)及端點處的一階導數值 y' (x ) = 1.86548, y' (x ) = -0.046115
標簽: 計算方法上機實習題目
上傳時間: 2020-06-27
上傳用戶:zg250
x=[1,2,0,-1,3,2];h=[1,-1,1]; y1=x*h(1); y2=x*h(2); y3=x*h(3); Y1=[0,0,y1]; Y2=[0,y2,0]; Y3=[y3,0,0]; y=Y1+Y2+Y3; L=-2:1:5; figure(1); subplot(211);stem(L,y,'*'); xlabel('L');ylabel('y');title('(1)'); X=x.';X=X'; r1=X*y(1);r2=X*y(2);r3=X*y(3);r4=X*y(4); r5=X*y(5);r6=X*y(6);r7=X*y(7);r8=X*y(8); R1=[0,0,0,0,0,0,0,r1];R2=[0,0,0,0,0,0,r2,0]; R3=[0,0,0,0,0,r3,0,0];R4=[0,0,0,0,r4,0,0,0]; R5=[0,0,0,r5,0,0,0,0];R6=[0,0,r6,0,0,0,0,0]; R7=[0,r7,0,0,0,0,0,0];R8=[r8,0,0,0,0,0,0,0]; R=R1+R2+R3+R4+R5+R6+R7+R8; n=-7:5; subplot(212);stem(n,R);title('(2)');
標簽: ketang
上傳時間: 2020-11-10
上傳用戶:
本設計方案中我采用多路復用器,2-4譯碼器,LED燈和或門等器件來完成設計。用2個74x151多路復用器擴展為16-2多路復用器,題目中的地址代碼A、B、C、D4個輸入端作為擴展的多路復用器的地址端,DO-D8作為數據端。開箱鑰匙孔信號E作為2-4decoder的使能端。設計開鎖的正確代碼為0101,當用鑰匙開鎖(即2-4decoder的使能端有效〉時,如果正確輸入開鎖密碼:0101,則輸出Y為邏輯高電平,Y’為邏輯低電平,鎖被打開,而LED燈不會亮(即不會報警);如果輸入的密碼錯誤或者鑰匙孔信號無效,則輸出Y為邏輯低電平,Y’為邏輯高電平,鎖無法打開,邏輯高電平Y’驅動LED燈亮,產生報警效果。2.設計原理圖:(以下電路圖為用QuartusI蹤合后截屏所得) 本設計方案中我采用多路復用器,2-4譯碼器,LED燈和或門等器件來完成設計。用2個74x151多路復用器擴展為16-2多路復用器,題目中的地址代碼A、B、C、D4個輸入端作為擴展的多路復用器的地址端,DO-D8作為數據端。開箱鑰匙孔信號E作為2-4decoder的使能端。設計開鎖的正確代碼為0101,當用鑰匙開鎖(即2-4decoder的使能端有效〉時,如果正確輸入開鎖密碼:0101,則輸出Y為邏輯高電平,Y’為邏輯低電平,鎖被打開,而LED燈不會亮(即不會報警);如果輸入的密碼錯誤或者鑰匙孔信號無效,則輸出Y為邏輯低電平,Y’為邏輯高電平,鎖無法打開,邏輯高電平Y’驅動LED燈亮,產生報警效果。2.設計原理圖:(以下電路圖為用QuartusI蹤合后截屏所得)
標簽: 密碼鎖
上傳時間: 2021-04-26
上傳用戶:情可傾想
復活節計算 int y, n, a, q, b, m, w, d, mm = 4; y = atoi(argv[1]); n = y-1900; a = fmod(n,19);
上傳時間: 2021-07-09
上傳用戶:scfan2004
THIS PUBLICATION IS COPYRIGHT PROTECTEDCopyright ? 2014 IEC, Geneva, SwitzerlandAll rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any formor by any means, electronic or mechanical, including photocopying and microfilm, without permission in writing fromeither IEC or IEC's member National Committee in the country of the requester. If you have any questions about IECcopyright or have an enquiry about obtaining additional rights to this publication, please contact the address below oryour local IEC member National Committee for further information.Droits de reproduction réservés. Sauf indication contraire, aucune partie de cette publication ne peut être reproduiteni utilisée sous quelque forme que ce soit et par aucun procédé, électronique ou mécanique, y compris la photocopieet les microfilms, sans l'accord écrit de l'IEC ou du Comité national de l'IEC du pays du demandeur. Si vous avez desquestions sur le copyright de l'IEC ou si vous désirez obtenir des droits supplémentaires sur cette publication, utilisezles coordonnées ci-après ou contactez le Comité national de l'IEC de votre pays de résidence.
標簽: iec標準
上傳時間: 2021-10-21
上傳用戶:kent