Info

この質問は閉じられています。 編集または回答するには再度開いてください。

reassigning a value in a piecewise function

4 ビュー (過去 30 日間)
A EIrar
A EIrar 2019 年 3 月 21 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
syms y(x)
y(x) = piecewise(0<=x<25, 0,25<=x<=75, 1,75<x<=100, 0);
fplot(y)
xlim([0 100])
ylim([0 1.2])
title('a1')
I am trying to reassigned the value x=50 and to be y=1.5 and regraph it again (but I can do that)?

回答 (2 件)

Star Strider
Star Strider 2019 年 3 月 21 日
I am not exactly certain what you want to do.
Try this:
syms y(x)
y(x) = piecewise(0<=x<25, 0,25<=x<=50, 0.5+x/50, 50<=x<=75,2.5-x/50, 75<x<=100, 0);
figure
fplot(y)
xlim([0 100])
ylim([0 2.0])
title('a1')
Experiment to get the result you want.

Walter Roberson
Walter Roberson 2019 年 3 月 21 日
y(x) = piecewise(x==50, 1.5, y(x));

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by