Missing a Display command? Wrong syntax?

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)

 采纳的回答

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
use
disp (n),disp(W)
instead of disp (n),(W)

类别

帮助中心File Exchange 中查找有关 MATLAB Mobile Fundamentals 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by