I'm trying to get the values of n in a column and the value of W a column next to it with titles, am i missing something somewhere?
clear format bank N=input('Please enter a value of n: ');
W = zeros(N,1) ; W(1) = 25 ; for n = 2:N W(n) = (W(n-1) +7) -(7*n/(n-1)) ; end disp(' N Wn ') disp (n),(W)

 채택된 답변

KSSV
KSSV 2017년 3월 30일

0 개 추천

N=input('Please enter a value of n: ');
W = zeros(N,1) ;
W(1) = 25 ;
for n = 2:N
W(n) = (W(n-1) +7) -(7*n/(n-1)) ;
end
T = table ;
T.n = [1:N]' ;
T.W = W ;
T

추가 답변 (1개)

ES
ES 2017년 3월 30일
편집: ES 2017년 3월 30일

0 개 추천

use
disp (n),disp(W)
instead of disp (n),(W)

카테고리

제품

질문:

2017년 3월 30일

편집:

ES
2017년 3월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by