MATLAB Answers

My piecewise function graph is not showing

2 ビュー (過去 30 日間)
John Grand
John Grand 2021 年 5 月 25 日
コメント済み: Asmit Singh 2021 年 5 月 26 日
I'm trying to plot the the function below, here is what I have
f(x) = 2x x ∈ [0, 0.5]
2x − 1 x ∈ (0.5, 1]
syms x
grid on;


Asmit Singh
Asmit Singh 2021 年 5 月 25 日
It is my understanding that you need to visualize the function you have provided as text, ie
The code that you have provided, mentions 2*x(-1) instead of 2*x-1. The following code illustrates the changes :
syms x
grid on;
  2 件のコメント
Asmit Singh
Asmit Singh 2021 年 5 月 26 日
The 6 at the end denotes the value of the functions, when none of the conditions are matched, I assumed that it was your default value. You can have a look at the documentation for the piecewise function for further details.


その他の回答 (0 件)


Community Treasure Hunt

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

Start Hunting!

Translated by