create a graph with a specific interval

5 ビュー (過去 30 日間)
Milo Llimo
Milo Llimo 2021 年 12 月 1 日
コメント済み: Jon 2021 年 12 月 1 日
  2 件のコメント
Steven Lord
Steven Lord 2021 年 12 月 1 日
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.
Milo Llimo
Milo Llimo 2021 年 12 月 1 日
n=0:35
x1=sin((pi/17)*n);
stem(x1)
axis([0 35 -1.5 1.5])
grid on
my problem is in n values are not correct, 35 must be not included

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

回答 (1 件)

Jon
Jon 2021 年 12 月 1 日
If you want n to have integer values greater than zero and strictly less than 35 you can define
n = 0:34
If you don't require the values to be integers but just want them equally spaced up to some value slightly less than 35 you could use
tol = 1e-6; % amount less than 35 that you want to reach
nMax = 35 - tol; % final value for n
numPoints = 100; % number of equally space points that you want
n = linspace(0,nMax,numPoints)
  2 件のコメント
Milo Llimo
Milo Llimo 2021 年 12 月 1 日
Thanx
Jon
Jon 2021 年 12 月 1 日
Are you all set now? If this answered your question please Accept the answer so others will know an answer is available.

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

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by