Matlab中怎样实现这个分段函数呢?c=[11,5,5,6,7,7,7;13,5,5,6,7,7,7;11,5,5,9,7,7,7;11,5,5,6,7,7,8;13,5,8,6,7,7,7;8,5,5,9,7,7,8];Cl = [5.6,3.5,3.5,4.2,4.9,4.9,4.9];Ch = [10.4,6.5,6.5,7.89.1,9.1,9.1];i = ones(1,7);for m = 1:6 a = c(m,:)
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/15 14:44:34
Matlab中怎样实现这个分段函数呢?c=[11,5,5,6,7,7,7;13,5,5,6,7,7,7;11,5,5,9,7,7,7;11,5,5,6,7,7,8;13,5,8,6,7,7,7;8,5,5,9,7,7,8];Cl = [5.6,3.5,3.5,4.2,4.9,4.9,4.9];Ch = [10.4,6.5,6.5,7.89.1,9.1,9.1];i = ones(1,7);for m = 1:6 a = c(m,:)
Matlab中怎样实现这个分段函数呢?
c=[11,5,5,6,7,7,7;13,5,5,6,7,7,7;11,5,5,9,7,7,7;11,5,5,6,7,7,8;13,5,8,6,7,7,7;8,5,5,9,7,7,8];
Cl = [5.6,3.5,3.5,4.2,4.9,4.9,4.9];
Ch = [10.4,6.5,6.5,7.89.1,9.1,9.1];
i = ones(1,7);
for m = 1:6
a = c(m,:) % a是c数组中对应m行的数据
怎样实现这个分段函数呢?要求是a中的每一个数字都要和Cl,Ch以及i中的数字进行比较.
Matlab中怎样实现这个分段函数呢?c=[11,5,5,6,7,7,7;13,5,5,6,7,7,7;11,5,5,9,7,7,7;11,5,5,6,7,7,8;13,5,8,6,7,7,7;8,5,5,9,7,7,8];Cl = [5.6,3.5,3.5,4.2,4.9,4.9,4.9];Ch = [10.4,6.5,6.5,7.89.1,9.1,9.1];i = ones(1,7);for m = 1:6 a = c(m,:)
你这个被积函数比较复杂,估计只能用matlab的ode45之类的数值积分方法了.给你提供了一个代码例子,你可以按照自己实际数据修改.
function test
clc;
close all;
format short g
phi_ij=@(x,y) phi_i(x,y)*phi_j(x,y);
options = odeset('RelTol',1e-4,'AbsTol',1e-5);
[X,Y] = ode45(phi_ij,[0 1],0,options);
M_ij=Y(end)
plot(X,Y)
grid on;
end
function res = phi_i( x , y )
xi=[0 0.5 1.0];
if( x