フィルターのクリア

how to write code for this equation?

2 ビュー (過去 30 日間)
ajeet verma
ajeet verma 2017 年 8 月 4 日
回答済み: Star Strider 2017 年 8 月 4 日
equation is here R(x)=1-0.4[cos(x/100)], 0<=x<=511 i am trying like this clc; clear all; s = @(x) (1-0.4*(cos(x/100))).*(0<=x & x<=511); x = linspace(0, 20); R = s(x); figure(1),plot(R,x) but i am not getting desired graph as given for particular equation

採用された回答

Star Strider
Star Strider 2017 年 8 月 4 日
You need ‘x’ to be longer, and you need to reverse the arguments to your plot call. (The axis call is not absolutely necessary.)
Try this:
s = @(x) (1-0.4*(cos(x/100))).*(0<=x & x<=511);
x = linspace(0, 500);
R = s(x);
figure(1)
plot(x,R)
axis([xlim 0 1.5])

その他の回答 (1 件)

John D'Errico
John D'Errico 2017 年 8 月 4 日
編集済み: John D'Errico 2017 年 8 月 4 日
Um, you got exactly what you plotted? My crystal ball is so cloudy today, that I cannot read your mind.
What did you want to see?
Did you want to see a curve that went over the domain for x of [0,511]? If so, is there a good reason why you generated x that only goes from 0 to 20? Should MATLAB read your mind that what you told it to do is not what you wanted to see?
Is there a reason why you plotted x versus y, thus y on the x axis, and x on the y axis? Again, how can I or MATLAB know that you told it to do something that may or may not be what you wanted?
When you get something strange, look carefully at what you did. Think about what you told the computer to do. Don't expect that it will read your mind. Instead, all it will read are the lines you typed.

カテゴリ

Help Center および File ExchangeGeometric Transformation and Image Registration についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by