答案 0 :(得分:2)
您可以通过多种方式进行操作。这是其中两个:
function q54615569(B, K)
y = @(x)(x>=B).*(x-K);
x = 0:2*K;
figure(); plot(x, y(x));
xlabel('S(T)');
function q54615569(B, K)
y = @(x)x-K;
x = 0:2*K;
figure(); hL = plot( x(x<=B), 0.*x(x<=B), x(x>=B), y(x(x>=B)) );
set(hL, 'Color', lines(1), 'Linestyle', 'none', 'Marker','o','MarkerSize', 2,...
'MarkerFaceColor', lines(1));
xlabel('S(T)');