convexcombs.m

来自「线性代数实验及MATLAB入门,电子工业出版社出版 陈怀琛 龚杰民合著」· M 代码 · 共 16 行

M
16
字号
function convexcombs(x,y,h)
% The function convexcombs(x,y,h) plots convex
% combinations of x and y
%     (1-t)x+ty
% for t=0, h, 2h, ..., 1
% The default value for h is 0.01 when only two
% input arguments are used.
if nargin==2
    h=0.01;
end    
for t=0:h:1
    q=(1-t)*x+t*y;
    plot(q(1),q(2),'.')
    hold on
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?