Plotting the range of a variable with defined intervals.

48 ビュー (過去 30 日間)
Brooke Burgos
Brooke Burgos 2022 年 2 月 10 日
編集済み: AndresVar 2022 年 2 月 10 日
Given f(x), I'm asked to plot f(x) with a green curve and blue x-marks on the same plot. x ranges from 0 to 1 and the intervals of the blue x-marks are 0.1. I also need to label the axes. I believe I need to use feval but I'm unsure how. Thank you!

回答 (1 件)

AndresVar
AndresVar 2022 年 2 月 10 日
編集済み: AndresVar 2022 年 2 月 10 日
The plot documentation shows you can specify the type of line and markers like this
x=0:0.1:1; % use colon notation to create a vector from 0 to 1 every 0.1
y=x.^2; % here for example f(x) is a parabola
plot(x,y,'-xg') % specify the a line with 'x' marker and green color '-xg'
xlabel('x'); % label axis with 'xlabel'
ylabel('y');
For more information about plotting use the command 'doc plot'

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by