Saturday 27 April 2019

plot - MATLAB - Plotting multiple graphs

I am new to MATLAB and am having difficulty plotting multiple graphs. Here are my vectors to graph:



S = [1.2421
2.3348
0.1326
2.3470
6.7389
3.7089
11.8534
-1.8708

...]

Y = [1.1718
1.8824
0.3428
2.1057
1.6477
2.3624
2.1212
-0.7971

...]

w = [0.1753
0.3277]


S is my training data and Y is my output vector. Then I add a column vector to my training data:



O = ones(length(S), 1)
X = [S 0]


w = inv(X'*X)*X'*Y


So I am trying to plot X, Y and w on the same graph. I plot w first, hold, X and this is where I get lost. Basically they are not on the same scale because the size of x is much less than X (X and Y are both vectors of size 100 and w is of size 2).



plot(w)


In MATLAB: result of plot(w)




Then I do:



hold
plot(X)


In MATLAB: result of hold, plot(X)



Now the w that I plotted is so small compared to the plot of X. How would I make them the same scale? Also maybe making them a different color?

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...