Missing a Display command? Wrong syntax?

1 回表示 (過去 30 日間)
Bryce Standkey
Bryce Standkey 2017 年 3 月 30 日
編集済み: ES 2017 年 3 月 30 日
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 日
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)

カテゴリ

Help Center および File ExchangeWhos についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by