Skip to content

Instantly share code, notes, and snippets.

@elvircrn
Created August 25, 2017 22:25
Show Gist options
  • Select an option

  • Save elvircrn/ee5501bb6a79f4157e095de4e47ff897 to your computer and use it in GitHub Desktop.

Select an option

Save elvircrn/ee5501bb6a79f4157e095de4e47ff897 to your computer and use it in GitHub Desktop.
# Level 1
disp (a) -> display a
a.' -> transponovano
a' -> transponovano konjugovano
feval(X, Y, f);
meshgrid -> ovo ti treba za mesh
mesh -> s ovim crtas mesh
```scilab
5 + 2 * %i; // 5 + 2i
```
### Poserem se na meshgrid
```scilab
function plotme2(fun)
xaxis = linspace(-4, 4, 70);
deff('[z] = f(x, y)', 'z = ' + fun);
[X, Y] = meshgrid(xaxis, xaxis);
Z = feval(X(1,:), Y(:,1), f);
disp(X);
mesh(X, Y, Z);
endfunction
plotme2('1/ (x^2 + y^2)');
```
# Level 2
### Djeljenje
A \ B = inv(A) * B;
A / B = A * inv(B);
#### Leftdiv
```scilab
A \ B;
inv(A) * B;
pinv(A) * B; // Penrose-Moore pseudo-inverse matrix
```
### Korisne funkcije
```scilab
cond -> // faktor uslovljenosti
spec -> // Singular valuei
chol -> // Cholesky
rref -> // Kanonski oblik ustrojen po redovima
```
### SVD Faktorizacija
```scilab
[U, S, V] = svd(A);
S <- Singular values
```
### Testmatrix
```scilab
testmatrix({ 'magi', 'hilb' }, n);
^ ^
| |
Magic square Hilbert
```
### Singular values via QR
![alt text](confused.jpg "Wut")
# Level 3
``` scilab
[y] = interp1(trainx, trainy, x, [method])
* "linear"
* "spline"
```
Runge one-liner
```scilab
1 ./ (1 + (25 * (x .^ 2))); // where x is a vector
```
# Level 4
```scilab
P1 = poly(1:2:5,"x","c"); // koeficijenti
P2 = poly(1:3:10,"x","r"); // nule
```
```scilab
roots(P1); // Nule polinoma
horner(P1, 5); // Evaluacija polinoma
F=chepol(4,"x"); // Chebishev 4. stepena varijable x
```
# Level 5
```scilab
derivat(P3); // Izvod polinoma
pd = derivat(p);
[J,H] = numderivative(f, x, h, order, H_form);
[y] = intg(a, b, f);
```
# Level 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment