Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

MATLAB APPRECIATION THREAD

Name: Anonymous 2011-04-09 0:33

What's your favorite thing about MATLAB / Simulink?
It's hard to choose but for me I'd probably have to go with the powerful matrix math and plot tools.


clear;clc;close all;
k = 5; %highest order fourier series
n = 2^13; %length of vectors
t_n = 2 * pi;
t = linspace(0, t_n, n);
w_0 = 2*pi/t_n; %angular frequency

%function definition
f = sin(t) .* (t < t_n/4);
f = f + 1 .* (t >= t_n/4);
f = f - (cos(t)+1) .* (t >= t_n/2);
f = f .* (t < 3*t_n/4);

t=t';f=f'; %transpose to create column vectors
a=ifft(f); %Fourier series coefficients

p=ones(n,k)*a(1)/2;
for i = 2 : k
    for j = 2 : i
        p(:,i)=p(:,i) + real(a(j))*cos((j-1)*w_0*t) ...
                      + imag(a(j))*sin((j-1)*w_0*t);
    end
end
p=2*p;

plot(t,f,'k'); hold on;
plot(t,p,'-.');
xlabel('t');ylabel('f');title('Fourier Series Approximations of f');
legend('f','1^s^t order approximation', ...
    '2^n^d order approximation', ...
    '3^n^d order approximation', ...
    '4^t^h order approximation', ...
    '5^t^h order approximation');

%%%%%%%%%%%
clear f;
n = 2 ^ 6;
x = linspace(-3, 3, n);
k = 3; %order of polynomial

%build polynomial
p=x;
for i = 2 : k
    r = (x(n)-x(1)) * (rand()-.5);
    p = p .* (x - r);
end

%build random function
for i = 1 : n
    f(i) = p(i) + 15 * (rand() - .5);
end
q = polyval(polyfit(x,f,k),x); %curve fit random function

figure(2);
hold on;
plot(x,f,'.');plot(x,q,'k');plot(x,p,'m');
xlabel('x');ylabel('y');title('3^r^d order curve fit of random function');
legend('Random Data','Curve Fit of Random Data','Original Polynomial');

fprintf('Max difference between curve fit and original polynomial: %f\n', max(abs(p-q)));

Name: BLACK HITLER 2011-04-30 0:43

glory BLACK AFRIKA HEIL NIGGERS. HEIL BLACK AFRIKA. NIG HEIL BLACK HITLER!

Name: BLACK HITLER 2011-04-30 0:45

glory BLACK AFRIKA HEIL NIGGERS. HEIL BLACK AFRIKA. NIG HEIL BLACK HITLER!

Name: WHITE HITLER 2011-04-30 0:47

glory WHITE EUROPE HEIL HONKEYS. HEIL WHITE EUROPE. SIG HEIL WHITE HITLER!

Name: WHITE HITLER 2011-04-30 0:48

glory WHITE EUROPE HEIL HONKEYS. HEIL WHITE EUROPE. SIG HEIL WHITE HITLER!

Name: WHITE HITLER 2011-04-30 0:50

glory WHITE EUROPE HEIL HONKEYS. HEIL WHITE EUROPE. SIG HEIL WHITE HITLER!

Name: Anonymous 2011-04-30 6:23

Name: Anonymous 2011-05-08 2:03

>>40
>>40
Suck my dick.

Name: Anonymous 2011-05-08 2:08

MORE LIKE
SCATLAB
AMIRITE LOLLLLLLLLLLLLLLLLLLLLLLLZzz!!11oNE!!1ONE1!

Name: Anonymous 2011-05-08 8:55

Okay.

So, question 1: what happened here? Why was this thread trolled into the ground?

Statement 1: when you get down to it, >>1, Matlab's innate matrix/vector support is the only thing to love about it. The rest is just libraries—and libraries can be ported. If I had to pick something else, though, I would probably say that I found its syntax nice most of the time, but I really wish it just used curly brackets instead of all those messy ends. It's like they're trying to be Pascal or PL/I, but can't quite figure out what the hell they're doing. It's really distracting, especially when there's obviously just C++ underneath everything.

Name: Anonymous 2011-05-08 21:26

>>249
It's written mostly in C, and a little bit of Java.

You underestimate just how useful the matrix math is.

As a former engineering student, it would have taken 10 times as long for the simulations I did in any other language. In fact a simple task, such as what was done in >>1, would be annoying as fuck any other way.

Name: Chat for /prog/ 2011-05-09 2:35

Looking for a good time? http://trollmegle.cel3stial.com/

Name: Anonymous 2011-05-10 12:38

>>249
So, question 1: what happened here? Why was this thread trolled into the ground?
Happened when everyone was spamming the board. Also no one wants to post seriously.

Name: Anonymous 2011-05-23 0:30

>>73
Mathematica is worthless unless you need symbolic math. And if you need symbolic math you are doing something very wrong.

Name: Anonymous 2011-05-23 0:58

>>253
I do all my symbolic math by hand, but that's because I don't need it too often, but for those that do need it, I'd say its an invaluable tool.

Name: Anonymous 2011-05-23 1:33

>253
There are plenty of cases in scientific computing where doing symbolic math is critical—finding the equation for a complicated integral, for example. Simpler cases exist, too, like rearranging an equation with a division operation in it so that the division occurs in the most numerically stable way possible. With some really complex equations, it's just not feasible to do it by hand like >>254.

Name: Anonymous 2011-05-23 13:08

finding the equation for a complicated integral
Numerically integrate

Name: Anonymous 2011-05-23 13:54

>>256
Inefficient in the long run.

Name: Anonymous 2011-05-23 13:56

>>256
Inefficient in the long run.

Name: Anonymous 2012-11-22 1:33

>>57
MATLAB doesn't force you to indent your code

Name: Anonymous 2013-05-30 18:08

Spam the thread

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List