Created
May 26, 2013 13:00
-
-
Save mzdravkov/5652713 to your computer and use it in GitHub Desktop.
Octave tasks from classwork.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p = [1 -3 2]; | |
r = roots(p); | |
x = linspace(-1, 3); | |
plot(x, polyval(p, x)); | |
hold on; | |
plot(r, zeros(size(r)), "marker", "x", "markersize", 21, "color", "red", "linestyle", "none") | |
hold on; | |
plot(x, zeros(size(x)), '.', 'color', 'red'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = y = linspace(-360, 360, 26); | |
[xx, yy] = meshgrid (x, y); | |
z = sin(xx .* yy); | |
surf(xx, yy, z); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%# x = y = linspace(-360, 360, 10) | |
%# x = y = 0.2:10; | |
x = y = linspace(0.2, 10, 100); | |
r = sqrt(x .^ 2 + y .^ 2); | |
[xx, yy] = meshgrid(x, y); | |
%# u = 1/(r .^ 12) - 1/(r .^ 6); | |
%# surf(xx, yy, u); | |
u = 1 ./ (r .^ 12) - 1 ./ (r .^ 6); | |
plot(r, u); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment