Function SciLab绘图

Function SciLab绘图,function,matlab,graph,graphing,scilab,Function,Matlab,Graph,Graphing,Scilab,您将如何在SciLab或MatLab中绘制这些曲线?我是新手,不知道软件是如何工作的。请帮忙 $Plot following functions with different colors in Scilab or MatLab – f2(x) = logn – f3(x) = n – f4(x) = nlogn – f5(x) = n2 – f6(x) = nj (j > 2) – f7(x) = cn (c > 1) – f8(x) = n! whe

您将如何在SciLab或MatLab中绘制这些曲线?我是新手,不知道软件是如何工作的。请帮忙

$Plot following functions with different colors in Scilab or MatLab
–   f2(x) = logn
–   f3(x) = n
–   f4(x) = nlogn
–   f5(x) = n2
–   f6(x) = nj (j > 2)
–   f7(x) = cn (c > 1)
–   f8(x) = n!

where x = linspace(1, 50, 50).

很多都是内置的功能。比如说

>> x = linspace(1,50,50);
>> plot(x,log(x))
>> plot(x,x)
>> plot(x,x.*log(x))
>> plot(x,x.^2)
我不知道
nj(j>2)
cn(c>1)
应该是什么意思

对于最后一个,您应该查看函数
factorial

从上下文来看,不清楚是应该将它们绘制在不同的图形上,还是全部绘制在同一个图形上。如果所有数据都在同一个图形上,则可以使用

>> hold on;
冻结当前轴-这意味着任何新线都将在旧线之上绘制,而不是在一组新轴上绘制

在Matlab(可能在Scilab中)中,您可以向
plot
函数提供一个“line spec”参数,该参数告诉函数绘制线条的颜色和样式。比如说,

>> figure
>> hold on
>> plot(x,log(x),'b')
>> plot(x,x/10,'r')
>> plot(x,x.^2/1000,'g')
告诉Matlab以蓝色绘制函数
f(x)=log(x)
f(x)=x/10
以红色绘制,以绿色绘制函数
f(x)=x^2/1000,结果如下:


我还不能发表评论或投票,但我要补充Chris Taylor的回答,在Scilab中,没有使用
保持
保持
约定。输出到当前轴的所有打印命令,这些轴始终“保持打开”。如果要生成新图形或更改当前轴,可以使用
figure(n)
,其中
n
可以是任何(非连续)正整数-实际上只是一个标签

另请参见
clf(n)
gcf()
gca()
-Scilab的图形处理与Matlab有很大不同,尽管matplotlib ATOMS模块在某种程度上使Scilab的外观和行为更像Matlab