フィルターのクリア

Scaling up without a loop (Math question)

1 回表示 (過去 30 日間)
Kelsey Allis
Kelsey Allis 2021 年 2 月 7 日
回答済み: Walter Roberson 2021 年 2 月 7 日
Hello,
I need to find a way to scale the x - value back up without using a loop. After the while loop runs and x = sum((x .^ n )./ factorial(n)), I have to scale it back up by squaring it as many times as the while loop ran. My instructor does not want me to do a loop to do this, but I am not sure how to keep squaring the value c times without a loop. Any feedback would be appreciated!
a = x ;
c = 0 ;
n = [ 0 : 14 ] ;
while ( abs(x) >= 1/2)
x = x/2 ;
c = c + 1 ;
end
x = sum((x .^ n )./ factorial(n))
est = x^2*(c+1) ;
% for i = 1 : (c-1)
%est = est^2 ;
act = exp(a)
end

回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 2 月 7 日
est.^(2*(c-1))

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by