フィルターのクリア

Plot the two functions for a specific range

3 ビュー (過去 30 日間)
Austen Thomas
Austen Thomas 2018 年 1 月 20 日
回答済み: Walter Roberson 2018 年 1 月 20 日
in the picture shown with the code i cant figure out how to make just one line in the graph. It should be 3.141592 for the first 7 intervals, then curve up without the line below it

回答 (2 件)

Image Analyst
Image Analyst 2018 年 1 月 20 日
You need to define M(i) in both cases because it will get referenced and printed in both cases.
Also, don't use "elseif i > 7" simply use "else".

Walter Roberson
Walter Roberson 2018 年 1 月 20 日
You have plot(M,a) . That uses M as the x axes and a as the y axes. You do not initialize M from 1 to 7, so it will be 0, and a is constant over those points. That means that the first 7 points are all at (0,pi), and things proceed from there. If an entry for M ever becomes less than the previous entry then the line is going to go "backwards".
You should reconsider whether you truly want M to be your x axes, or if instead you want 1:20 to be your x axes.

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by