【发布时间】:2015-06-01 22:23:06
【问题描述】:
我有一个包含一些常量参数的 matlab 函数,我想在同一个图上绘制该函数,在更改该常量的值时(可能)使用保持。 这是我的代码:
close all
clear all
clc
m = 5;
x = 1:1:10;
y = m*x + 10;
h1 = figure;
plot(x,y)
m = 10;
figure(h1);
hold on
plot(x,y,': r')
当我尝试使用这段代码时,我得到了两条相互重合的行;它看起来matlab刚刚使用了参数m的最后一个值,我怎样才能让它使用不同的值。
我找到了一些东西here,但不能满足我的需求。
有什么建议吗?
【问题讨论】:
标签: matlab plot matlab-figure