Feed on
Posts
Comments

Archive for the 'Matlab' Category

if you’re trying to solve for m in the equation y = mx, simply: matlab >> m = x(:) \ y(:) [found on matlabcentral.]

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));

move x-axis to top of matlab figure

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’)

to set the length of tickmarks to 0, try this command: >> set(gca,’Ticklength’,[0 0])

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 […]

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])

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.

split a delimited string in matlab

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’);

to change the orientation with which a matlab figure is printed in, use the orient command: >> figure; orient landscape >> figure; orient portrait

to suppress warning statements from printing in matlab, precede your code with: warning off

Next »

More blogs about http://desk.stinkpot.org:8080/tricks.