I want to create a matrix with entries -1, 0, and 1 but it gives only -1 and 1, how to adjust
x = [9 3.6 9; 11 3.6 9; 9 4.4 9; 11 4.4 9; 9 3.6 11; 11 3.6 11;9 4.4 11; 11 4.4 11];
% convertion to -1, 0, and 1
V = ( x(:,1) - min(x(:,1)) )/(range(x(:,1))/2) - 1; %% This line needs some modifications
% NOW convert to MATRIX (-1. 0, and 1)
% Below lines also need some modifications
X = [(x(:,1) - min(x(:,1)))/1 - 1 (x(:,2) - min(x(:,2)))/0.4 - 1 (x(:,3) - min(x(:,3)))/1 - 1]
X = 8×3
-1.0000 -1.0000 -1.0000 1.0000 -1.0000 -1.0000 -1.0000 1.0000 -1.0000 1.0000 1.0000 -1.0000 -1.0000 -1.0000 1.0000 1.0000 -1.0000 1.0000 -1.0000 1.0000 1.0000 1.0000 1.0000 1.0000

댓글 수: 3

Stephen23
Stephen23 2024년 2월 9일
편집: Stephen23 2024년 2월 9일
What value/s (or rows of values) should be mapped to zero?
Or more generally, what values should be mapped to -1, 0, 1 ?
Dinesh
Dinesh 2024년 2월 9일
Please explain what you are trying to achieve!
MINATI PATRA
MINATI PATRA 2024년 2월 9일
like the output of,
dBB = bbdesign(3)
%% Can be found in https://in.mathworks.com/help/stats/bbdesign.html

댓글을 달려면 로그인하십시오.

 채택된 답변

Matt J
Matt J 2024년 2월 9일
편집: Matt J 2024년 2월 9일
Perhaps this is what you had in mind?
x = [9 3.6 9; 11 3.6 9; 9 4.4 9; 11 4.4 9; 9 3.6 11; 11 3.6 11;9 4.4 11; 11 4.4 11];
X=rescale(x,-1,1,InputMin=min(x,[],2), InputMax=max(x,[],2) )
X = 8×3
1.0000 -1.0000 1.0000 1.0000 -1.0000 0.4595 1.0000 -1.0000 1.0000 1.0000 -1.0000 0.3939 0.4595 -1.0000 1.0000 1.0000 -1.0000 1.0000 0.3939 -1.0000 1.0000 1.0000 -1.0000 1.0000
X(abs(X)<1)=0
X = 8×3
1 -1 1 0 -1 0 1 -1 1 1 -1 0 0 -1 0 0 -1 0 0 -1 1 1 -1 1

댓글 수: 4

MINATI PATRA
MINATI PATRA 2024년 2월 9일
looks right Matt, Thanks
I will check & Implement.
MINATI PATRA
MINATI PATRA 2024년 2월 13일
이동: Matt J 2024년 2월 13일
Dear Matt J
Your idea needs some modification for the following work, Please get into:
('0' is not coming)
P = [T.p1 T.p2 T.p3]; x = P;
X = rescale( x,-1,1,InputMin = min(x,[],2), InputMax = max(x,[],2) );
X(abs(X)<1) = 0
MINATI PATRA
MINATI PATRA 2024년 2월 13일
이동: Matt J 2024년 2월 13일
Here is the answer (attached pdf) to match the output.
MINATI PATRA
MINATI PATRA 2024년 2월 13일
Dear Matt
Why here is an option "Moved"? I didnot get that.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

질문:

2024년 2월 9일

댓글:

2024년 2월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by