필터 지우기
필터 지우기

Display just output of function and not the "ans" from the function.

조회 수: 1 (최근 30일)
For this simple function that I have:
% This code takes in two inputs, Z and X.
% eg. Z = [ 2; 7], X = [ 1, 1; 1, 2]. From these two inputs, the
% values for theta1,LS and theta2,LS are calculated.
%__________________________________________________________________________
function theta1LS_theta2LS = LSE(Z,X)
X_transpose = X.'; % Transpose of Matrix X
Theta = inv(X_transpose * X)*X_transpose*Z; % Theta
theta1LS_theta2LS = inv(X_transpose * X)*X_transpose*Z; % Theta
theta1LS = theta1LS_theta2LS(1);
theta2LS = theta1LS_theta2LS(2);
fprintf(' theta1LS = %6.3f \n theta1LS = %6.3f \n',theta1LS, theta2LS);
end
I just wanted to display the theta1LS and theta2LS numbers.
I do get the theta1LS and theta2LS numbers, but then at the end, I also get ans = -3.0000 5.0000.
How to just get the theta1LS and theta2LS numbers to display and not the "ans" numbers?
%

채택된 답변

Walter Roberson
Walter Roberson 2015년 9월 20일
Prob_3_7_new(Z,X);
Notice the semi-colon after the expression.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by