フィルターのクリア

Info

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

if i have y4='0.2+6' is there a way to make p=0.2+6 but keeping the numbers like that and not equaling it to 6.2.

1 回表示 (過去 30 日間)
Elliott Cameron
Elliott Cameron 2020 年 4 月 26 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
if i have y4='0.2+6' is there a way to make p=0.2+6 but keeping the numbers like that and not equaling it to 6.2.
  14 件のコメント
Steven Lord
Steven Lord 2020 年 4 月 28 日
If the function to be evaluated is always going to be a polynomial, another option would be to store it as a vector of coefficients and use polyval to evalute it.
p = [-0.2, 20];
x = 0:0.25:5;
y = polyval(p, x)
One potential benefit this has over the anonymous function is that you could manipulate or query the coefficients by indexing into p.
David Goodmanson
David Goodmanson 2020 年 4 月 28 日
Hi Elliott,
could you just do something like
x = 6.2
xintdec = [floor(x) x-floor(x)]
xintdec = 0.2000 6.0000
y = xintdec*rand
y = 0.1265 3.7942

回答 (0 件)

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by