convexcombs.m

来自「matlab 在线性代数中的应用 利用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 + -
显示快捷键?