【问题标题】:Matlab: Plot graph to functionMatlab:绘制图形到函数
【发布时间】:2015-02-11 03:12:32
【问题描述】:

我正在尝试弄清楚如何将图形绘制到以下函数:

谁能帮忙?

【问题讨论】:

    标签: matlab function graph plot find


    【解决方案1】:

    使用逻辑索引!更多信息见this link,逻辑索引是在使用Matlab时熟悉的非常有用的东西!

    x=0:0.01:2*pi; %// or whatever range of x you want
    f=sin(x); %// calculate sin(x)
    f(f<=0.5)=0.5; %// make the values of sin(x) less than or equal to 0.5 equal to 0.5
    f(f>=0.7)=0.7;
    plot(x,f) %// plot the result!
    

    【讨论】:

    • 感谢您的回复。
    猜你喜欢
    • 2014-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多