MATLAB Answers

Plot3 with different length of vectors

조회 수: 42(최근 30일)
fadams18 9 Jan 2019
댓글: fadams18 9 Jan 2019
I have 3 parameter. Error, SNR, Weights
1. Error is a 3x9 data
2. SNR = [15,30,50]
3. Weights = 0.1:0.1:0.9
So basically, i want to see the evolution of my error with respect to the weight and SNR
I have done this with surf. but I want to try plot3, unfortunaley it doesnt work when length of vectors are unequal. is there a work around this?

  댓글 수: 0

로그인 to comment.

채택된 답변

Adam Danz
Adam Danz 9 Jan 2019
편집: Adam Danz 9 Jan 2019
You need to specify the x (SNR) and y (Weight) coordinate for each z-value (error). Since z is a matrix, x and y need to be matricies of the same size.
SNR = repmat([15 30 50]', 1, size(error,2)); %note the transpose
Weight = repmat(0.1 : 0.1 : 0.9, size(error,1),1);
plot3(SNR, Weight, error)

  댓글 수: 3

fadams18 9 Jan 2019
Thanks a lot. it works like magic. Although visually not so nice looking. Any tips on improving graphics maybe? :)
Adam Danz
Adam Danz 9 Jan 2019
I'm not sure what you're expecting. plot3() draws a line for each column of data in the inputs.
Are you lookng for a surface plot?
surf(SNR, Weight, error)
Or are you looking for a continuous line?
plot3(SNR(:), Weight(:), error(:))
fadams18 9 Jan 2019
You right it looks good with Surf. Thanks mate!.

로그인 to comment.

추가 답변(0개)

이 질문에 답변하려면 로그인을(를) 수행하십시오.

Translated by