Path: blob/master/Week 2/Octave Tutorial/4. Plotting Data/plotting_data.txt
625 views
GNU Octave, version 4.4.11Copyright (C) 2018 John W. Eaton and others.2This is free software; see the source code for copying conditions.3There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or4FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.56Octave was configured for "x86_64-w64-mingw32".78Additional information about Octave is available at https://www.octave.org.910Please contribute if you find this software useful.11For more information, visit https://www.octave.org/get-involved.html1213Read https://www.octave.org/bugs.html to learn how to submit bug reports.14For information about changes from previous versions, type 'news'.1516octave:1> t = [0:0.01:0.98]17t =1819Columns 1 through 11:20210.00000 0.01000 0.02000 0.03000 0.04000 0.05000 0.06000 0.07000 0.08000 0.09000 0.100002223Columns 12 through 22:24250.11000 0.12000 0.13000 0.14000 0.15000 0.16000 0.17000 0.18000 0.19000 0.20000 0.210002627Columns 23 through 33:28290.22000 0.23000 0.24000 0.25000 0.26000 0.27000 0.28000 0.29000 0.30000 0.31000 0.320003031Columns 34 through 44:32330.33000 0.34000 0.35000 0.36000 0.37000 0.38000 0.39000 0.40000 0.41000 0.42000 0.430003435Columns 45 through 55:36370.44000 0.45000 0.46000 0.47000 0.48000 0.49000 0.50000 0.51000 0.52000 0.53000 0.540003839Columns 56 through 66:40410.55000 0.56000 0.57000 0.58000 0.59000 0.60000 0.61000 0.62000 0.63000 0.64000 0.650004243Columns 67 through 77:44450.66000 0.67000 0.68000 0.69000 0.70000 0.71000 0.72000 0.73000 0.74000 0.75000 0.760004647Columns 78 through 88:48490.77000 0.78000 0.79000 0.80000 0.81000 0.82000 0.83000 0.84000 0.85000 0.86000 0.870005051Columns 89 through 99:52530.88000 0.89000 0.90000 0.91000 0.92000 0.93000 0.94000 0.95000 0.96000 0.97000 0.980005455octave:2> y1 = sin(2*pi*4t)56parse error:5758syntax error5960>>> y1 = sin(2*pi*4t)61^6263octave:2> y1 = sin(2*pi*4*t)64y1 =6566Columns 1 through 11:67680.00000 0.24869 0.48175 0.68455 0.84433 0.95106 0.99803 0.98229 0.90483 0.77051 0.587796970Columns 12 through 22:71720.36812 0.12533 -0.12533 -0.36812 -0.58779 -0.77051 -0.90483 -0.98229 -0.99803 -0.95106 -0.844337374Columns 23 through 33:7576-0.68455 -0.48175 -0.24869 -0.00000 0.24869 0.48175 0.68455 0.84433 0.95106 0.99803 0.982297778Columns 34 through 44:79800.90483 0.77051 0.58779 0.36812 0.12533 -0.12533 -0.36812 -0.58779 -0.77051 -0.90483 -0.982298182Columns 45 through 55:8384-0.99803 -0.95106 -0.84433 -0.68455 -0.48175 -0.24869 -0.00000 0.24869 0.48175 0.68455 0.844338586Columns 56 through 66:87880.95106 0.99803 0.98229 0.90483 0.77051 0.58779 0.36812 0.12533 -0.12533 -0.36812 -0.587798990Columns 67 through 77:9192-0.77051 -0.90483 -0.98229 -0.99803 -0.95106 -0.84433 -0.68455 -0.48175 -0.24869 -0.00000 0.248699394Columns 78 through 88:95960.48175 0.68455 0.84433 0.95106 0.99803 0.98229 0.90483 0.77051 0.58779 0.36812 0.125339798Columns 89 through 99:99100-0.12533 -0.36812 -0.58779 -0.77051 -0.90483 -0.98229 -0.99803 -0.95106 -0.84433 -0.68455 -0.48175101102octave:3> y2 = cos(2*pi*4*t)103y2 =104105Columns 1 through 10:1061071.000000 0.968583 0.876307 0.728969 0.535827 0.309017 0.062791 -0.187381 -0.425779 -0.637424108109Columns 11 through 20:110111-0.809017 -0.929776 -0.992115 -0.992115 -0.929776 -0.809017 -0.637424 -0.425779 -0.187381 0.062791112113Columns 21 through 30:1141150.309017 0.535827 0.728969 0.876307 0.968583 1.000000 0.968583 0.876307 0.728969 0.535827116117Columns 31 through 40:1181190.309017 0.062791 -0.187381 -0.425779 -0.637424 -0.809017 -0.929776 -0.992115 -0.992115 -0.929776120121Columns 41 through 50:122123-0.809017 -0.637424 -0.425779 -0.187381 0.062791 0.309017 0.535827 0.728969 0.876307 0.968583124125Columns 51 through 60:1261271.000000 0.968583 0.876307 0.728969 0.535827 0.309017 0.062791 -0.187381 -0.425779 -0.637424128129Columns 61 through 70:130131-0.809017 -0.929776 -0.992115 -0.992115 -0.929776 -0.809017 -0.637424 -0.425779 -0.187381 0.062791132133Columns 71 through 80:1341350.309017 0.535827 0.728969 0.876307 0.968583 1.000000 0.968583 0.876307 0.728969 0.535827136137Columns 81 through 90:1381390.309017 0.062791 -0.187381 -0.425779 -0.637424 -0.809017 -0.929776 -0.992115 -0.992115 -0.929776140141Columns 91 through 99:142143-0.809017 -0.637424 -0.425779 -0.187381 0.062791 0.309017 0.535827 0.728969 0.876307144145octave:4> plot(t,y2);146octave:5> plot(t,y1);147octave:6> plot(t,y2);148octave:7> plot(t,y1);149octave:8> plot(t,y2);150octave:9> plot(t,y1);151octave:10> hold on;152octave:11> plot(t,y2,'r');153octave:12> xlabel('time');154octave:13> ylabel('value');155octave:14> legend('sin','cos');156octave:15> title('Merged Plot');157octave:16> figure(1);158octave:17> plot(t,y1);159octave:18> figure(2);160octave:19> plot(t,y2);161octave:20> subplot(1,2,1); #Divides plot 1x2 grid (1st two args, last arg: 1st element)162octave:21> plot(t,y1);#plot the sine graph in the 1sy grid163octave:22> plot(t,y2);#plot the cosine graph in the 1st grid164octave:23> subplot(1,2,2);165octave:24> plot(t,y2);#plot the cosine graph in the 2nd grid166octave:25> plot(t,y2);#plot the cosine graph in the 2nd grid167#line 21-25 gave me wrong output because I plotted the 2nd one in 1st grid168octave:26> subplot(1,2,1);169octave:27> plot(t,y1);170octave:28> subplot(1,2,2);171octave:29> plot(t,y2);172octave:30> axis([0.5 1 -1 1])173octave:31> #Range - vertical: 0.5 -1, horizontal: -1 1174octave:31> clf; #clear figure175octave:32> subplot(1,2,1);176octave:33> plot(t,y1);177octave:34> subplot(1,2,2);178octave:35> plot(t,y2);179octave:36> clf;180octave:37> A = magic(5)181A =18218317 24 1 8 1518423 5 7 14 161854 6 13 20 2218610 12 19 21 318711 18 25 2 9188189octave:38> imagesc(A); #Plots a 5x5 grid with diff colors190octave:39> color bar191warning: the 'color' function belongs to the optim package from Octave Forge192which you have installed but not loaded. To load the package, run 'pkg193load optim' from the Octave prompt.194195Please read <https://www.octave.org/missing.html> to learn how you can196contribute missing functionality.197error: 'color' undefined near line 1 column 1198octave:39> pkg load optim199octave:40> color bar200warning: the 'color' function belongs to the optim package from Octave Forge but201has not yet been implemented.202203Please read <https://www.octave.org/missing.html> to learn how you can204contribute missing functionality.205error: 'color' undefined near line 1 column 1206octave:40> colorbar207octave:41> imagesc(A), colorbar, colormap(green);208error: 'green' undefined near line 1 column 32209octave:41> imagesc(A), colorbar, colormap green;210error: colormap: failed to set MAP <green>211error: called from212colormap at line 111 column 11213octave:41> imagesc(A), colorbar, colormap gray;214octave:42> imagesc(A), colorbar, colormap blue;215error: colormap: failed to set MAP <blue>216error: called from217colormap at line 111 column 11218octave:42> help colormap;219'colormap' is a function from the file C:\Octave\OCTAVE~1.1\share\octave\4.4.1\m\image\colormap.m220221-- CMAP = colormap ()222-- CMAP = colormap (MAP)223-- CMAP = colormap ("default")224-- CMAP = colormap (MAP_NAME)225-- CMAP = colormap (HAX, ...)226-- colormap MAP_NAME227Query or set the current colormap.228229With no input arguments, 'colormap' returns the current color map.230231'colormap (MAP)' sets the current colormap to MAP. The colormap232should be an N row by 3 column matrix. The columns contain red,233green, and blue intensities respectively. All entries must be234between 0 and 1 inclusive. The new colormap is returned.235236'colormap ("default")' restores the default colormap (the 'viridis'237map with 64 entries). The default colormap is returned.238239The map may also be specified by a string, MAP_NAME, which is the240name of a function that returns a colormap.241242If the first argument HAX is an axes handle, then the colormap for243those axes is queried or set.244245For convenience, it is also possible to use this function with the246command form, 'colormap MAP_NAME'.247248The list of built-in colormaps is:249250Map Description251--------------------------------------------------------------------------252viridis default253jet colormap traversing blue, cyan, green, yellow, red.254cubehelix colormap traversing black, blue, green, red, white with255increasing intensity.256hsv cyclic colormap traversing Hue, Saturation, Value space.257rainbow colormap traversing red, yellow, blue, green, violet.258--------- --------------------------------------------------------------259hot colormap traversing black, red, orange, yellow, white.260cool colormap traversing cyan, purple, magenta.261spring colormap traversing magenta to yellow.262summer colormap traversing green to yellow.263autumn colormap traversing red, orange, yellow.264winter colormap traversing blue to green.265--------- --------------------------------------------------------------266gray colormap traversing black to white in shades of gray.267bone colormap traversing black, gray-blue, white.268copper colormap traversing black to light copper.269pink colormap traversing black, gray-pink, white.270ocean colormap traversing black, dark-blue, white.271--------- --------------------------------------------------------------272colorcube equally spaced colors in RGB color space.273flag cyclic 4-color map of red, white, blue, black.274lines cyclic colormap with colors from axes "ColorOrder"275property.276prism cyclic 6-color map of red, orange, yellow, green, blue,277violet.278--------- --------------------------------------------------------------279white all white colormap (no colors).280281See also: viridis, jet, cubehelix, hsv, rainbow, hot, cool, spring,282summer, autumn, winter, gray, bone, copper, pink, ocean, colorcube,283flag, lines, prism, white.284285Additional help for built-in functions and operators is286available in the online version of the manual. Use the command287'doc <topic>' to search the manual index.288289Help and information about Octave is also available on the WWW290at https://www.octave.org and via the [email protected]291mailing list.292octave:43> imagesc(A), colorbar, colormap ocean;293octave:44> imagesc(A), colorbar, colormap copper;294octave:45> imagesc(A), colorbar, colormap prism;295octave:46> imagesc(A), colorbar, colormap flag;296octave:47> imagesc(A), colorbar, colormap lines;297octave:48> imagesc(A), colorbar, colormap colorcube;298octave:49> imagesc(A), colorbar, colormap cubehelix;299octave:50> imagesc(A), colorbar, colormap hsv;300301