代码搜索结果
找到约 12,326 项符合
M 的代码
mutation.m
function y=mutation(chrom,P_mutation,Popsize,ecope) %均匀变异
m=25;
% P=rand(Popsize,1);
% n=find(P
cross_over.m
function y=cross_over(chrom)
% [m,n]=size(chrom);
% temchrom=zeros(1,n);
% for i=1:2:m-1
% % c=rand(1);
% % temchrom=chrom(i,:);
% % chrom(i,:)=c.*chrom(i,:)+(1-c).*chrom(i+1,:);
%
hermite.m
%f(x)=sin(x)
%x=0.5:0.2:1.9;
%y=[0.4794,0.6442,0.7833,0.8912,0.9636,0.9975,0.9917,0.9463];
x=-1:0.01:1;
y=1./(1+25*x.^2);
y1=-50./(1+25.*x.^2).^2.*x;%y的导数
n=length(x);
x1=-0.9:0.1:0.9;
m=lengt
deuler.m
a=0;
b=1;
N=40;
af=1;
Euler(a,b,N,af);
%Taylor(a,b,N,af);
%RK(a,b,N,af);
ft.m
function y=ft(x)
y=4/(1+x^2);
hotqch.m
clear all
close all
a=0;b=1;m=10;T=0.5;N=1000;af=1;
f=inline('sin(pi*x)','x');
h=(b-a)/m;
k=T/N;
lmd=af^2*k/h^2; %注意lmd一定要小于0.5,只有这样差分法才稳定
x=linspace(a,b,m+1);
u(1,1:N+1)=0;
u(m+1,1:N+1)=0;
ytiao.m
function y=ytiao(x,x1,m,h)
n=length(x);
L=length(x1);
for k=1:L
for i=1:n-1
if (x1(k)>=x(i)&x1(k)
fitpt.m
function fp=fitpt()
%最小二乘
%基取{1, x, ...}
%fitpt.m
%默认算例为课本:P65,例3.2
% x=[0,1,2,3,4,5,6,7]
% y=[3.95,6.82,9.78,12.91,15.74,19.26,21.73,24.07]
%结果:P(x) = 4.005 + 2.936x 平方误差=0.6162
%MatLab函
yangtiao.m
function yangtiao(X,Y,x)
n=length(X);
m=length(x);
for i=1:n-1
h(i)=X(i+1)-X(i);
end
for i=2:n-1
l(i)=h(i+1)/(h(i)+h(i+1));
u(i)=1-l(i);
g(i)=3*(l(i)*(Y(i)-Y(i-1))/h(i-1))+u(i
euler.m
function A=euler(a,b,u0)
h=(b-a)/10;
t(1)=a;
u1(1)=u0;
u2(1)=u0;
for i=2:11
u1(i)=u1(i-1)+h*f1(t(i-1),u1(i-1));
u2(i)=u2(i-1)+(h/2)*...
(f1(t(i-1),u2(i-1))+f1(t(i-1)+h,u2(i-1)