摘要: function x = gauss(A,B)%The sizes of matrices A,B are supposed to be NA x NA and NA x NB.%This function solves Ax = B by Gauss elimination algorithm.NA = size(A,2); [NB1,NB] = size(B);if NB1 ~= NA error('A and B must have compatible dimensions');endN = NA + NB; AB = [A(1:NA,1:NA) B(1:NA,1:NB 阅读全文
posted @ 2013-05-22 16:29 StanleyWu 阅读(281) 评论(0) 推荐(0) 编辑
摘要: 用二分法找出的根function y=funcbisect01(x);y=3*x^5-2*x^3+6*x-8;x1=1;x2=2; tol=0.00001;while (abs(x1-x2)>tol) f1=funcbisect01(x1); f2=funcbisect01(x2); xm=(x1+x2)/2; fm=funcbisect01(xm); if (f1*fm<0) x2=xm; else x1=xm; endend 阅读全文
posted @ 2013-05-22 00:36 StanleyWu 阅读(247) 评论(0) 推荐(0) 编辑