best linear fit through the origin in matlab
Posted in Matlab on July 22nd, 2010 No Comments »
if you’re trying to solve for m in the equation y = mx, simply: matlab >> m = x(:) \ y(:) [found on matlabcentral.]
Posted in Matlab on July 22nd, 2010 No Comments »
if you’re trying to solve for m in the equation y = mx, simply: matlab >> m = x(:) \ y(:) [found on matlabcentral.]
Posted in Matlab on December 13th, 2009 4 Comments »
here’s an easy way to do low-pass signal filtering in matlab: function [s_data_v] = fftsmooth(data_v,freq_n) % use fft low pass filter to smoothen out a signal fft_data_v = fft(data_v); s_fft_data_v = zeros(1,length(data_v)); s_fft_data_v(1:freq_n) = fft_data_v(1:freq_n); s_fft_data_v(end-freq_n:end) = fft_data_v(end-freq_n:end); s_data_v = real(ifft(s_fft_data_v));
Posted in Matlab on December 5th, 2009 6 Comments »
to move the x-axis on a figure from the bottom of your plot to the top, adjust the ‘xaxislocation’ variable of your current axis handle: matlab>> set(gca,’XAxisLocation’,’top’)
Posted in Matlab on September 14th, 2009 No Comments »
to set the length of tickmarks to 0, try this command: >> set(gca,’Ticklength’,[0 0])
Posted in Matlab on February 16th, 2009 2 Comments »
i prefer to make all of my powerpoint and keynote slides with dark backgrounds and white text. i find these slides to be much more readable in a dark room; the problem with this setup though is that most figure-making software automatically draw dark lines. matlab falls into this category. to make matlab automatically create […]
Posted in Matlab on February 12th, 2009 No Comments »
a friend once asked: Having previously benefited from your stinkpot.org tricks, I’m wondering if you know a way to fix the output size (e.g., dimensions in pixels or inches) of Matlab figures. here’s one way of going about rotating the paper orientation figure and then setting its dimensions (in inches): set(gcf,’PaperOrientation’,’landscape’) set(gcf,’PaperPosition’,[0,0,11,8.5])
Posted in Mac OS X, Matlab on January 13th, 2009 No Comments »
i tried starting matlab and got the following error in my console: 1/13/09 9:39:16 PM [0x0-0x1d01d].com.mathworks.matlab[139] dyld: Library not loaded: /private/var/automount/mathworks/BLR/devel/bat/Amake/build/3gp/install/5172124/maci/hdf5/lib/libhdf5.0.dylib turns out that the problem was trying to start matlab by clicking on the “matlab” executable. instead, try clicking on the “startmatlab” alias.
Posted in Matlab on November 6th, 2008 12 Comments »
to split a delimited string in matlab, you can use the ‘regexp’ function. for instance, if i’ve got a string named tline that’s been tab-delimited, i can parse it using:  >> parts = regexp(tline,’\t’,’split’);
Posted in Matlab on October 22nd, 2008 1 Comment »
to change the orientation with which a matlab figure is printed in, use the orient command: >> figure; orient landscape >> figure; orient portrait
Posted in Matlab on October 22nd, 2008 5 Comments »
to suppress warning statements from printing in matlab, precede your code with: warning off