0
새로운 MATLAB을하고 나는 코드의 비트가 I가 주어졌다 이해할 수 없다 :matlab에 테이블 화 구문
x = 1; % initial guess = 1
Tol = 5e-9; % correct to 8 decimal places
count = 0;
f=0.54030231; % f(1)= 0.54030231
fprintf('step x f(x)\n')
fprintf('---- ----------- ----------\n')
fprintf('%1i %12.8f %12.8f\n',count,x,f)
while abs(f)>Tol %loop until the absolute value of f is smaller than tolerance
count = count + 1
deriv = -sin(x); ; % first derivative of f(x)
x2 = x - (f/deriv); % new value of x
x = x2;
f = cos (x); % new value of f(x)
fprintf('%3i %12.8f %12.8f\n',count,x,f)
end
이 프로그램은 내가 이해 방정식의 뿌리를 찾기위한 뉴턴 방법입니다.
fprintf('---- ----------- ----------\n')
fprintf('%1i %12.8f %12.8f\n',count,x,f)
질문 : 왜 두 번째 줄의 마지막 비트는 n으로
- 을 나누어 이해가 안 무엇
이 부분입니까?
- 두 번째 줄에있는 숫자는 무엇입니까? 즉, % 1i, % 12.8f 등은 무엇입니까?
- 어떻게이 작업이 'count, x, f'와 함께 작동합니까?
감사 n \
['fprintf'] (http://www.mathworks.com/help/matlab/ref/fprintf.html)의 설명서를 읽었습니까? 네가하지 않았다면 왜 안 되니? 네가 그랬다면, 너는 이해 못하는게 뭐야? –