Simple Iterative expression needed solved

조회 수: 1 (최근 30일)
James Paltani
James Paltani 2020년 4월 30일
댓글: Walter Roberson 2020년 4월 30일
Assuming w is an integer (w = 1, 2, 3, …), write an iterative calculation to determine the minimum w value that will bring the result of the following expression to greater than 10,000. Display this minimum w value and the corresponding result of the expression.

답변 (2개)

Walter Roberson
Walter Roberson 2020년 4월 30일
initialize. while the condition is not met, increment.
  댓글 수: 4
James Paltani
James Paltani 2020년 4월 30일
편집: James Paltani 2020년 4월 30일
This is what i have so far.. it says illegal "greater than" operator. What should i differently
clc,clear
syms w
e = sqrt((10*w^2)-4*w+2);
for e > 10000,
solve(w)
Walter Roberson
Walter Roberson 2020년 4월 30일
syms w
e = sqrt((10*w^2)-4*w+2);
w = ceil(max(double(solve(e==10000))));
But this does not use a loop like you are required to do. You should not be using symbolic toolbox for this problem.
You should be initializing w to the lowest value of the range. Then you calculate e based on that w. Test whether it has reached the necessary value yet. If it has not, increment w and recalculate e and loop back.

댓글을 달려면 로그인하십시오.


Mrutyunjaya Hiremath
Mrutyunjaya Hiremath 2020년 4월 30일
w = 1; y = 0;
while(y < 10000)
% your equation
y = sqrt(10*w*w - 4*w + 2);
w = w + 1;
end
disp(w)
disp(y)
  댓글 수: 1
Walter Roberson
Walter Roberson 2020년 4월 30일
We recommend against providing complete solutions to homework assignments.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by