Undefined function or variable 'x'.
조회 수: 3 (최근 30일)
이전 댓글 표시
This is a function that conducts t-tests.
x=[197, 161, 144, 162, 185, 154, 136, 130]
% y=[204, 182, 140, 178, 183, 163, 156, 143]';
%
% Usage:
% [CI, tcrit, H, Pval, tstat, df] = myttestfcn(x, y, testtype, side, alpha)
% x = vector of operations
% mu0 = hypothesized mean
%
% testtype = 0 if Welch’s t-test
% = 1 if Pooled t-test
% = 2 if Paired t-test
%
% side = 0 if two-sided test
% = 1 if left-sided test
% = 2 if right-sided test
%
% alpha = the level of the test a number on interval (0,1)
% Confidence level = 1 - alpha
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [CI, tcrit, H, df] = myttestfcn(x, y, testtype, side, alpha)
댓글 수: 0
답변 (1개)
Walter Roberson
2016년 11월 24일
Your line
x=[197, 161, 144, 162, 185, 154, 136, 130]
should be commented out. The code from "Usage:" on down should be saved in myttestfcn.m . To invoke the function you will need to go to the command line and invoke it there, such as
x=[197, 161, 144, 162, 185, 154, 136, 130];
y=[204, 182, 140, 178, 183, 163, 156, 143]';
[ci, crit, h, df] = myttestfcn(x, y, 2, 1, 0.5)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 String Parsing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!