同时改变一个参数的图形功能

问题描述 投票:0回答:1

我有一个Matlab函数,我想在将某个参数从100更改为1000的同时对其进行图形处理它是这样的:[c,errorrange] =函数[g1,g2,x];我想在x和c上绘制x

我想到了这样的东西:...

for i = 100: 1000
[c, error] = function [g1, g2, i];
A(i) = c;
end
for i = 1: 99
A(i) = 0;
end
plot(A); 

...但它不起作用;抱歉,如果我的问题不好,我是Matlab的新手。谢谢

matlab matlab-figure matlab-guide
1个回答
0
投票

类似的事情可能会让您入门:

x = 100:5:1000;
[c] = myfunc(1, 2, x);

plot(c, x)
xlabel('my function output c', 'FontSize', 10)
ylabel('my input x', 'FontSize', 10)
title("x versus c", 'FontSize', 12)

function [c] = myfunc(g1, g2, x)
    c = g1 .*x + g2; %dummy example
end
© www.soinside.com 2019 - 2024. All rights reserved.