if ~exist('param', 'var'),
param = defaultParam;
end
Note that
'param'
in the first line is in single quotes. It's a string, not the parameter itself.This allows for reordering of parameters unlike the case of checking
nargin
.
Scrapbook of useful code snippets I found while working on projects.
if ~exist('param', 'var'),
param = defaultParam;
end
'param'
in the first line is in single quotes. It's a string, not the parameter itself.nargin
.
/usr/local/bin/matlab
,
for i in $*;
do
params=" $params $d$i"
done
sudo /Applications/MATLAB_R20XXx_Student.app/bin/matlab $params
/Applications/MATLAB_R20XXx_Student.app/bin/matlab
should be your Matlab executable.
imagesc
). While one possibility would be to flip the data array via flipud
, my preferred method is to use the 'ydir'
option.
set(gca, 'ydir', 'normal');
This leaves the data as is, no flipping data, and only changes the the plot options, which separates data from presentation. (Model/View) ydir
is 'reverse'
which is the default direction of most graphics packages. tic
and
toc
.
tic
then stop it by calling toc
.
When toc
isn't assigned to a variable, it will print a timestamp summary to the console.
tic_id
to use multiple timers.
t_id = tic;
your_time_consuming_function();
toc(t_id)
MATLAB_your_version.app/java/patch/
/Applications/MATLAB_your_version.app/Contents/Info.plist
in your text editor of choice. You will need to open it as administrator (using sudo
).CFBundleVersion
. The value for CFBundleVersion
will be something like 2.1. Change it to 9.1.
env = abs(hilbert(x));
% create modulated signal
fc = 100;
fm = 17;
fs = 8000;
t = 0:1/fs:1;
x = sin(2*pi*fc*t) .* (1.5+sin(2*pi*fm*t));
plot(t, x);
%% get modulation envelope
env = abs(hilbert(x));
hold on;
plot(t, env, 'r');
hold off;