-
求標(biāo)準(zhǔn)偏差
> function c=myfunction(x)
> [m,n]=size(x)
> t=0
> for i=1:numel(x)
> t=t+x(i)*x(i)
> end
> c=sqrt(t/(m*n-1))
function c=myfunction(x)
[m,n]=size(x)
t=0
for i=1:m
for j=1:n
t=t+x(i,j)*x(i,j)
end
end
c=sqrt(t/(m*n-1
標(biāo)簽:
gt
myfunction
function
numel
上傳時(shí)間:
2014-01-15
上傳用戶:hongmo
-
求標(biāo)準(zhǔn)偏差
> function c=myfunction(x)
> [m,n]=size(x)
> t=0
> for i=1:numel(x)
> t=t+x(i)*x(i)
> end
> c=sqrt(t/(m*n-1))
function c=myfunction(x)
[m,n]=size(x)
t=0
for i=1:m
for j=1:n
t=t+x(i,j)*x(i,j)
end
end
c=sqrt(t/(m*n-1
標(biāo)簽:
gt
myfunction
function
numel
上傳時(shí)間:
2013-12-26
上傳用戶:dreamboy36
-
求標(biāo)準(zhǔn)偏差
> function c=myfunction(x)
> [m,n]=size(x)
> t=0
> for i=1:numel(x)
> t=t+x(i)*x(i)
> end
> c=sqrt(t/(m*n-1))
function c=myfunction(x)
[m,n]=size(x)
t=0
for i=1:m
for j=1:n
t=t+x(i,j)*x(i,j)
end
end
c=sqrt(t/(m*n-1
標(biāo)簽:
gt
myfunction
function
numel
上傳時(shí)間:
2016-06-28
上傳用戶:change0329
-
求標(biāo)準(zhǔn)偏差
> function c=myfunction(x)
> [m,n]=size(x)
> t=0
> for i=1:numel(x)
> t=t+x(i)*x(i)
> end
> c=sqrt(t/(m*n-1))
function c=myfunction(x)
[m,n]=size(x)
t=0
for i=1:m
for j=1:n
t=t+x(i,j)*x(i,j)
end
end
c=sqrt(t/(m*n-1
標(biāo)簽:
gt
myfunction
function
numel
上傳時(shí)間:
2014-09-03
上傳用戶:jjj0202
-
設(shè)有由n個(gè)不相同的整數(shù)組成的數(shù)列,記為:
a(1)、a(2)、……、a(n)且a(i)<>a(j) (i<>j)
例如3,18,7,14,10,12,23,41,16,24。
若存在i1<i2<i3< … < ie 且有a(i1)<a(i2)< … <a(ie)則稱為長度為e的不下降序列。如上例中3,18,23,24就是一個(gè)長度為4的不下降序列,同時(shí)也有3,7,10,12,16,24長度為6的不下降序列。程序要求,當(dāng)原數(shù)列給出之后,求出最長的不下降序列。
標(biāo)簽:
整數(shù)
數(shù)列
上傳時(shí)間:
2013-12-14
上傳用戶:tonyshao
-
LCD 因其輕薄短小,低功耗,無輻射,平面直角顯示,以及影像穩(wěn)定等特點(diǎn),當(dāng)今應(yīng)用非常廣泛。CPLD(復(fù)雜可編程邏輯器件) 是一種具有豐富可編程功能引腳的可編程邏輯器件,不僅可實(shí)現(xiàn)常規(guī)的邏輯器件功能,還可以實(shí)現(xiàn)復(fù)雜而獨(dú)特的時(shí)序邏輯功能。并且具有ISP (在線可編\\r\\n程) [1 ] 功能,便于進(jìn)行系統(tǒng)設(shè)計(jì)和現(xiàn)場對系統(tǒng)進(jìn)行功能修改、調(diào)試、升級。通常CPLD 芯片都有著上萬次的重寫次數(shù),即用CPLD[ 2 ] 進(jìn)行硬件設(shè)計(jì),就像軟件設(shè)計(jì)一樣靈活、方便。而現(xiàn)今LCD的控制大都采用
標(biāo)簽:
CPLD
LCD
可編程邏輯器件
上傳時(shí)間:
2013-08-16
上傳用戶:zhliu007
-
Hopfield 網(wǎng)——擅長于聯(lián)想記憶與解迷路 實(shí)現(xiàn)H網(wǎng)聯(lián)想記憶的關(guān)鍵,是使被記憶的模式樣本對應(yīng)網(wǎng)絡(luò)能量函數(shù)的極小值。 設(shè)有M個(gè)N維記憶模式,通過對網(wǎng)絡(luò)N個(gè)神經(jīng)元之間連接權(quán) wij 和N個(gè)輸出閾值θj的設(shè)計(jì),使得: 這M個(gè)記憶模式所對應(yīng)的網(wǎng)絡(luò)狀態(tài)正好是網(wǎng)絡(luò)能量函數(shù)的M個(gè)極小值。 比較困難,目前還沒有一個(gè)適應(yīng)任意形式的記憶模式的有效、通用的設(shè)計(jì)方法。 H網(wǎng)的算法 1)學(xué)習(xí)模式——決定權(quán)重 想要記憶的模式,用-1和1的2值表示 模式:-1,-1,1,-1,1,1,... 一般表示: 則任意兩個(gè)神經(jīng)元j、i間的權(quán)重: wij=∑ap(i)ap(j),p=1…p; P:模式的總數(shù) ap(s):第p個(gè)模式的第s個(gè)要素(-1或1) wij:第j個(gè)神經(jīng)元與第i個(gè)神經(jīng)元間的權(quán)重 i = j時(shí),wij=0,即各神經(jīng)元的輸出不直接返回自身。 2)想起模式: 神經(jīng)元輸出值的初始化 想起時(shí),一般是未知的輸入。設(shè)xi(0)為未知模式的第i個(gè)要素(-1或1) 將xi(0)作為相對應(yīng)的神經(jīng)元的初始值,其中,0意味t=0。 反復(fù)部分:對各神經(jīng)元,計(jì)算: xi (t+1) = f (∑wijxj(t)-θi), j=1…n, j≠i n—神經(jīng)元總數(shù) f()--Sgn() θi—神經(jīng)元i發(fā)火閾值 反復(fù)進(jìn)行,直到各個(gè)神經(jīng)元的輸出不再變化。
標(biāo)簽:
Hopfield
聯(lián)想
上傳時(shí)間:
2015-03-16
上傳用戶:JasonC
-
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NULL 0
#define MaxSize 30
typedef struct athletestruct /*運(yùn)動員*/
{
char name[20];
int score; /*分?jǐn)?shù)*/
int range; /**/
int item; /*項(xiàng)目*/
}ATH;
typedef struct schoolstruct /*學(xué)校*/
{
int count; /*編號*/
int serial; /**/
int menscore; /*男選手分?jǐn)?shù)*/
int womenscore; /*女選手分?jǐn)?shù)*/
int totalscore; /*總分*/
ATH athlete[MaxSize]; /**/
struct schoolstruct *next;
}SCH;
int nsc,msp,wsp;
int ntsp;
int i,j;
int overgame;
int serial,range;
int n;
SCH *head,*pfirst,*psecond;
int *phead=NULL,*pafirst=NULL,*pasecond=NULL;
void create();
void input ()
{
char answer;
head = (SCH *)malloc(sizeof(SCH)); /**/
head->next = NULL;
pfirst = head;
answer = 'y';
while ( answer == 'y' )
{
Is_Game_DoMain:
printf("\nGET Top 5 when odd\nGET Top 3 when even");
printf("\n輸入運(yùn)動項(xiàng)目序號 (x<=%d):",ntsp);
scanf("%d",pafirst);
overgame = *pafirst;
if ( pafirst != phead )
{
for ( pasecond = phead ; pasecond < pafirst ; pasecond ++ )
{
if ( overgame == *pasecond )
{
printf("\n這個(gè)項(xiàng)目已經(jīng)存在請選擇其他的數(shù)字\n");
goto Is_Game_DoMain;
}
}
}
pafirst = pafirst + 1;
if ( overgame > ntsp )
{
printf("\n項(xiàng)目不存在");
printf("\n請重新輸入");
goto Is_Game_DoMain;
}
switch ( overgame%2 )
{
case 0: n = 3;break;
case 1: n = 5;break;
}
for ( i = 1 ; i <= n ; i++ )
{
Is_Serial_DoMain:
printf("\n輸入序號 of the NO.%d (0<x<=%d): ",i,nsc);
scanf("%d",&serial);
if ( serial > nsc )
{
printf("\n超過學(xué)校數(shù)目,請重新輸入");
goto Is_Serial_DoMain;
}
if ( head->next == NULL )
{
create();
}
psecond = head->next ;
while ( psecond != NULL )
{
if ( psecond->serial == serial )
{
pfirst = psecond;
pfirst->count = pfirst->count + 1;
goto Store_Data;
}
else
{
psecond = psecond->next;
}
}
create();
Store_Data:
pfirst->athlete[pfirst->count].item = overgame;
pfirst->athlete[pfirst->count].range = i;
pfirst->serial = serial;
printf("Input name:) : ");
scanf("%s",pfirst->athlete[pfirst->count].name);
}
printf("\n繼續(xù)輸入運(yùn)動項(xiàng)目(y&n)?");
answer = getchar();
printf("\n");
}
}
void calculate() /**/
{
pfirst = head->next;
while ( pfirst->next != NULL )
{
for (i=1;i<=pfirst->count;i++)
{
if ( pfirst->athlete[i].item % 2 == 0 )
{
switch (pfirst->athlete[i].range)
{
case 1:pfirst->athlete[i].score = 5;break;
case 2:pfirst->athlete[i].score = 3;break;
case 3:pfirst->athlete[i].score = 2;break;
}
}
else
{
switch (pfirst->athlete[i].range)
{
case 1:pfirst->athlete[i].score = 7;break;
case 2:pfirst->athlete[i].score = 5;break;
case 3:pfirst->athlete[i].score = 3;break;
case 4:pfirst->athlete[i].score = 2;break;
case 5:pfirst->athlete[i].score = 1;break;
}
}
if ( pfirst->athlete[i].item <=msp )
{
pfirst->menscore = pfirst->menscore + pfirst->athlete[i].score;
}
else
{
pfirst->womenscore = pfirst->womenscore + pfirst->athlete[i].score;
}
}
pfirst->totalscore = pfirst->menscore + pfirst->womenscore;
pfirst = pfirst->next;
}
}
void output()
{
pfirst = head->next;
psecond = head->next;
while ( pfirst->next != NULL )
{
// clrscr();
printf("\n第%d號學(xué)校的結(jié)果成績:",pfirst->serial);
printf("\n\n項(xiàng)目的數(shù)目\t學(xué)校的名字\t分?jǐn)?shù)");
for (i=1;i<=ntsp;i++)
{
for (j=1;j<=pfirst->count;j++)
{
if ( pfirst->athlete[j].item == i )
{
printf("\n %d\t\t\t\t\t\t%s\n %d",i,pfirst->athlete[j].name,pfirst->athlete[j].score);break;
}
}
}
printf("\n\n\n\t\t\t\t\t\t按任意建 進(jìn)入下一頁");
getchar();
pfirst = pfirst->next;
}
// clrscr();
printf("\n運(yùn)動會結(jié)果:\n\n學(xué)校編號\t男運(yùn)動員成績\t女運(yùn)動員成績\t總分");
pfirst = head->next;
while ( pfirst->next != NULL )
{
printf("\n %d\t\t %d\t\t %d\t\t %d",pfirst->serial,pfirst->menscore,pfirst->womenscore,pfirst->totalscore);
pfirst = pfirst->next;
}
printf("\n\n\n\t\t\t\t\t\t\t按任意建結(jié)束");
getchar();
}
void create()
{
pfirst = (struct schoolstruct *)malloc(sizeof(struct schoolstruct));
pfirst->next = head->next ;
head->next = pfirst ;
pfirst->count = 1;
pfirst->menscore = 0;
pfirst->womenscore = 0;
pfirst->totalscore = 0;
}
void Save()
{FILE *fp;
if((fp = fopen("school.dat","wb"))==NULL)
{printf("can't open school.dat\n");
fclose(fp);
return;
}
fwrite(pfirst,sizeof(SCH),10,fp);
fclose(fp);
printf("文件已經(jīng)成功保存\n");
}
void main()
{
system("cls");
printf("\n\t\t\t 運(yùn)動會分?jǐn)?shù)統(tǒng)計(jì)\n");
printf("輸入學(xué)校數(shù)目 (x>= 5):");
scanf("%d",&nsc);
printf("輸入男選手的項(xiàng)目(x<=20):");
scanf("%d",&msp);
printf("輸入女選手項(xiàng)目(<=20):");
scanf("%d",&wsp);
ntsp = msp + wsp;
phead = (int *)calloc(ntsp,sizeof(int));
pafirst = phead;
pasecond = phead;
input();
calculate();
output();
Save();
}
標(biāo)簽:
源代碼
上傳時(shí)間:
2016-12-28
上傳用戶:150501
-
#include "string.h"
#include "ctype.h"
#include "stdio.h"
search(char pd[])
{FILE *fp;
int time=0,i=0,j=0,add[80],k=0,m;
char *ch,
str[900];
m=strlen(pd);
if((fp=fopen("haha.txt","r"))==NULL)
{
printf("Cannot open this file\n");
exit(0);
}
for(;!feof(fp);i++)
{
str[i]=fgetc(fp);
if(tolower(str[i])==tolower(pd[k]))
{k++;
if(k==m)
if(!isalpha(i-m)&&!isalpha((str[i++]=fgetc(fp))))
{
time++;
add[j]=i-m+1;
j++;
k=0;
}
else k=0;
}
}
if(time)
{
printf("The time is:%d\n",time);
printf("The adders is:\n");
for(i=0;i<j;i++)
printf("%5d",add[i]);
if(i%5==0)
printf("\n");
getch();
fclose(fp);
}
else
printf("Sorry!Cannot find the word(^_^)");
}
main()
{
char pd[10],choose='y';
int flag=1;
while(flag)
{printf("In put the word you want to seqarch:");
scanf("%s",pd);
search(strlwr(pd));
printf("\nWould you want to continue?(Y/N):");
getchar();
scanf("%c",&choose);
if((tolower(choose))=='n')
flag=0;
else flag=1;
}
printf("Thanks for your using!Bye-bye!\n");
getch();
}
標(biāo)簽:
學(xué)生專用
上傳時(shí)間:
2016-12-29
上傳用戶:767483511
-
# 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++){
//計(jì)算下一個(gè)值
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("經(jīng)過%d次雅可比迭代解出方程組的解:\n",n+1);
for(i=0;i<N;i++){
printf("%f ",y[i]);
}
}
//求兩個(gè)向量差的二范數(shù)函數(shù)
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;
}
標(biāo)簽:
C語言
編寫
迭代
上傳時(shí)間:
2019-10-13
上傳用戶:大萌萌撒