フィルターのクリア

How to draw straight horizontal line with specific axis

71 ビュー (過去 30 日間)
Abdullah Alasfour
Abdullah Alasfour 2023 年 7 月 18 日
回答済み: Image Analyst 2023 年 7 月 21 日
Hello, I am currently working on my project and I am new to Matlab. My question is how to plot straight line vector with specific axis? For Example, I want to plot horizontal line that starts from 1450 to 1470 ( this is the x -axis )

回答 (4 件)

Voss
Voss 2023 年 7 月 18 日
plot([1450 1470],[0 0]) % this line will be at y = 0 because I've given plot [0 0] as the y-coordinates
xlim([1400 1500]) % set the x-limits of the axes to something beyond the horizontal line so you can see it
  2 件のコメント
Abdullah Alasfour
Abdullah Alasfour 2023 年 7 月 18 日
Thank you for your help
Voss
Voss 2023 年 7 月 18 日
You're welcome! Any questions, let me know. Otherwise, please "Accept This Answer". Thanks!

サインインしてコメントする。


Cris LaPierre
Cris LaPierre 2023 年 7 月 18 日
plot? See Ch 9 in MATLAB Onramp. You might consider going through the entire onramp, too.
plot([1450 1470],[0 0])
  5 件のコメント
Cris LaPierre
Cris LaPierre 2023 年 7 月 18 日
Not sure we can provide an answer with the information we have.
Abdullah Alasfour
Abdullah Alasfour 2023 年 7 月 19 日
No problem, thank your for your help

サインインしてコメントする。


Tushar
Tushar 2023 年 7 月 18 日
Hello Abdullah, you can use the plot function and give the x- vector as per your requirements like shown here :
x = [1450, 1470]; % x-axis limits
y = [5, 5]; % y-values for the horizontal line, you can set your value, 5 is used here for just as example
plot(x, y, 'k-') % 'k-' represents a black solid line
xlim([1450, 1470]) % set the x-axis limits
Also find a documentation of the 2-D graph plots here : Link

Image Analyst
Image Analyst 2023 年 7 月 21 日
@Abdullah Alasfour I understand that you want to do bandpass filtering of a signal in the Fourier domain. While I don't have any examples of that exactly, I do have some other Fourier filtering demos that might help or at least be interesting. They are attached.
Basically you need to convert your signal to the spectral domain with fft, then zero out the frequencies (indexes) that you don't want, and then inverse transform with ifft

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by