Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
I can't figure out why x_array(i) isn't being assigned as a variable
조회 수: 1 (최근 30일)
이전 댓글 표시
if true
% code
end
clear;
clc;
i=1
angle_radians = 0;
num = input('Enter the number of terms to calculate(20 to 100):');
while num <= 19 || num > 100
if num <= 19
fprintf('You entered: %s, too few terms\n',num);
end
if num > 100
fprintf('You entered: %s, too many terms\n', num);
end
num = input('Enter the number of terms to calculate(20 to 100):');
while i:num
x_array(i) = angle_radians;
y_array(i) = sine_Taylor(angle_radians_radians,terms);
i = i + 1
end
end
plot(x_array(i),y_array(i))
fprintf('Sine function from Taylor series in Fig. 1\n')
fprintf('Sine Taylor series vs. sin Matlab function in Fig. 2\n')
fprintf('Program ended\n')
댓글 수: 0
답변 (1개)
Star Strider
2016년 4월 7일
I can’t run your code. Changing the nested while condition to:
while i <= num
might be a solution.
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!