text stringlengths 8 6.12M |
|---|
% Task 1
clear;
clc;
clf;
th = linspace(0,pi);
phi = linspace(0,2*pi);
for i=1:length(th)
for j=1:length(phi)
[Gth(i,j) Gphi(i,j)] = horizontalDipole( 1, th(i), phi(j));
end
end
figure(1)
subplot(1,2,1)
contour(th, phi, Gth);
xlabel('Angle $\theta$ [rad]','Interpreter','latex','Fontsize'... |
function handles = reset_OSA_imu(handles)
%Clear osa data from last run, reset indecies, reset plots, create a new
%log file
%Reset temporary data storage
handles.osa.time = zeros(1,5000);
handles.osa.Ax = zeros(1,5000);
handles.osa.Ay = zeros(1,5000);
handles.osa.Az = zeros(1,5000);
handles.osa.Gx = zeros(1,5000);
ha... |
function data = calc_bondline_distance(data, bondline_file)
% Calculate euclidian distance from each point to the bondline.
%
% Fits a bond plane from points provided in a file. Then from this best
% fit plane, bondline distances are calculated for each of the points in
% the statsdata. Negative distances are on the mi... |
function [Normal] =CalNormal1(Points)
x=Points(:,:,1);
y=Points(:,:,2);
z=Points(:,:,3);
[m,n] = size(x);
U1 = cat(3,diff(x,1,2),diff(y,1,2),diff(z,1,2));
V1 = cat(3,diff(x,1,1),diff(y,1,1),diff(z,1,1));
%U1(end,:,:)=[]; % V1(:,end,:)=[];
U2 = cat(3,-diff(x,1,2),-diff(y,1,2),-diff(z,1,2));
V2 = cat(3,-dif... |
function dy = diffequs_grat(t, y, k)
%% Differential equations of the model with a gratuitous protein
dy = zeros(17, 1); %s_i, a, r, e_t, e_m, q, mRNAs, complexes, gratuitous protein
gamma = k.gamma_max*y(2)/(k.K_gamma+y(2));
lambda = gamma*(y(11)+y(12)+y(13)+y(14)+y(17))/k.M;
nu_imp = y(4)*k.v_t*k.s/(k.K_t+k.s);
nu_... |
function [x, Cost] = LogBarrierSolver(A, b, c, t0, mu, epsilon)
%% Phase 1 - Find strictly feasible starting point
gamma_0 = max(-b)+ 1;
AA = [A -ones(size(A,1), 1);
zeros(1, size(A,2)) -1;];%lower bound constraint on gamma -> -gamma<=1 -> gamma > -1
bb = [b; 1];
cc = [zeros(size(A,2), 1); 1];
xx_0 = [zeros... |
function dxdt = dynamics_adaptive(t, x, um, ym, time_um,am,bm,a,b,gamma)
um_interp = interp1(time_um, um, t); % Interpolate the data set (time_um, um) at time t
ym_interp = interp1(time_um, ym, t); % Interpolate the data set (time_um, ym) at time t
dxdt(1,1)=x(2);
dxdt(2,1)=-am*x(2)-gamma*am*x(5)*um_interp+gamm... |
function sig_wave_height = sigWaveCalc(S);
maxIndices = islocalmax(S);
minIndices = islocalmin(S);
t1 = find(maxIndices);
t2 = find(minIndices);
%index arrays may not be exact same length
%find out which has less and use that as end index
if length(t1) < length(t2)
max_length = length(t1);
else
max_length ... |
%%%%%%%%%%%%%%%%
% Main program %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%
% Construct a questdlg with two options
choice = questdlg('Hello, please choose your Operating System?', ...
'Operating System', ...
'Mac','Windows','Linux','');
% Handle response
global os
switch choice
case... |
%% housekeeping
losstype='bal';
kerType='linear';
par1=[];par2=[];
Cs=5.^[3:-1:-3];
nfolds=5;
idx_control=subject_identifier(used_subjects==1)==0;
idx_patient=subject_identifier(used_subjects==1)==1;
fidx_control=find(subject_identifier(used_subjects==1)==0);
fidx_patient=find(subject_identifier(used_subjects==1)==1)... |
function routetable = findrouting(position, scale)
%%
parent = [0];
child = position;
tempchild = position;
routetable = [0];
while size(child,1) ~= 0
% flag = 1;
d = [];
local_route = [];
for i = 1 : 1 : size(parent, 1)
p_id = parent(i,end);
if p_id == 0
p_x = 0;
... |
function rms = computeRMS(A1,A2)
% Function for computing Root Mean Square between A1 and A2.
%
% Input
% A1: first pointcloud
% A2: second pointcloud
% Output:
% rms: RMS
rms = 0;
na1 = size(A1,2);
for i=1:na1
rms = rms + sum((A1(:,i) - A2(:,i)).^2);
en... |
function [ptemp]=model_function3(t1,t2,t3,t4,v)
%模型主函数
%定义变量
hcrou1=1.15e-6;%固态升温
hcrou2=1.85e-6;%液态升温
hcrou3=4.851e-7;%降温
%设定变量1
l=4.355;
global tstp;tstp=0.5;
dp=0.15e-3;%零件厚度
%计算
atime=l/v;
n=uint16((atime-rem(atime,tstp))/tstp);
ptemp=zeros(1,n);
ptemp(1,:)=25;
for t=0:tstp:(atime-rem(atime,tstp))-... |
function f = Fast_Phi( alpha, u )
%u: xPx^T (P: Kerdoc) b: xb^T (b: vector)
N=size(u,1);
C=size(alpha,1);
ratio=C/N;
alpha_temp=reshape(alpha,C/ratio,ratio);
alpha_temp=fht(alpha_temp);
f=sum(u.*alpha_temp,2);
f=f/sqrt(N);
end
|
% File name: Ex 2
% Name : Zhimingyuan Liu
% Description: design Finite Impulse Response Digital Filters and Infinite
% Impulse Response Digital Filters
clear all;
close all;
% finite Impulse Response
y = fir1(10, 0.3);
% Infinite Impulse Response Digital Filters
Yb = butter(10, 0.3);
%plot FIR
figure(1);
freqz(y,1... |
function T = Chebyshev( n )
% Chebyshev Chebyshev polynomials of the first kind.
% P = Chebyshev(N) returns a vector P of length N+1 whose elements are
% the coefficients of the N-degree Chebyshev polynomial of the first kind
% N in descending powers.
%
% See also Legendre, Hermite, Laguerre.
% Copyright ... |
function a = prox(x,sigma, param, lambda1)
switch param
case 1, a = sign(x) .* max( abs(x) - lambda1 * sigma, 0); % L1-norm, checked
end
|
function T = CS6640_FFT_angular(im)
% CS6640_FFT_angular - compute FFT angular texture parameters
% On input:
% im (MxN array): input image
% On output:
% T (M*Nx8 array): texture parameters
% each texture parameter is a column vector in T
% Call:
% T = CS6640_FFT_angular(im);
% Author:
% ... |
clc;clear;close;
fileName="/Users/sousic/SIAT/2nd_semester/DSP/Hw/HomeWork_1/dat.bin";
file = fopen(fileName);
origin_data=uint8(fread(file));
%第3题
bit_num=get_24bit(origin_data);
true_values=get_trueValue(bit_num);
voltages=(4.5/(2^24-1)*true_values);
% plot_data(voltages);
%第4题
means=mean(voltages);%均值
vars=var(vo... |
[name, label]=textread('train.txt','%s%d');
[row, col]=size(label);
multilabel=zeros(row, 100);
for i = 1:row
multilabel(i, label(i,1))=1;
end
filename = 'name.txt';
dlmwrite(filename, 1);
xlswrite(filename, name);
[file, num]=textread('name.txt','%d%s','delimiter','/');
filename = 'name.txt';
dlmwrite(... |
function [fitresult, gof] = fit_ankle_rotation(angle2, displ2, phasename)
global plot_norm subject_id
%CREATEFIT(DISPL2,ANGLE2)
% Create a fit.
%
% Data for 'untitled fit 4' fit:
% X Input : displ2
% Y Output: angle2
% Output:
% fitresult : a fit object representing the fit.
% gof : s... |
function [agent, stats] = train(varargin)
% Handle inputs
if ~nargin || isempty(varargin{1})
[sc, pl, en, S0, RL] = util.pre('environment', varargin{2:end});
else
[sc, pl, en, S0, RL] = util.pre(varargin{:});
end
% Initialize environment = engine
en.initial(S0, sc, pl, RL.targetreward);
% Fix random seed
... |
function example002()
message = '\nNhap m: ';
m = input(message);
message= '\nNhap n: ';
n = input(message);
a = ones(m, n);
b = zeros(m, n);
c = eye (m, n);
d = randi([-10 10], m, n);
a (1, 1) = 5;
e =size(a);
end
|
%spectral estimation
%creating 64 samples
n = 0:64;
x = 3*sin(0.8*pi*n);
r = randn(size(n));
x = x + r;
[pxx, w] = periodogram(x);
figure;
plot(w,2*log10(pxx));
xlabel( 'Frequency' );
ylabel( 'dB' );
title( 'Periodogram of Sine Signal', '64 samples' );
[pxx, w] = periodogram(r);
figure;
plot(w,2*log10(pxx... |
% Lec 6.4 : Interpolation Options in MATLAB
h = 0:24;
T = [25.6, 25.4 ,25.1, 24.9, 24.9, 25.2, 25.9, 26.3, 27.1, 29.3, 30.8, 31.2, 32.1, 31.0, 30.3, 31.4, 30.6, 31.8, 29.6, 28.4, 28.1, 27.4 , 26.8, 26.1,26.6];
% Interpolating temperature values
hI = [2.5 ,6.5, 10.25, 17.0];
TI = spline(h,T,hI);
|
function NewWay2GrabRaDecConvert2AzElforImageCalibration(filename,folder,imageName,xpixmax,ypixmax,lat,long,tUTCfilename)
X= dlmread(filename,'',2);
folder
imageName(2:end-5)
format long g
if class(xpixmax)=='char'
xpixmax=str2num(xpixmax)
end
if class(ypixmax)=='char'
ypixmax=str2num(ypixmax)
end
if class(lat... |
clear ; clc;
lpcOrder = 24;
method = 'Method 2';
winName = "hann";
preemphasise = 1;
fprintf("\nSelect a Trained Model");
[file,path] = uigetfile('*.mat');
load(fullfile(path,file));
fprintf("\nSelect the directory for the source testing data\n"); %Commands for selecting the source folder for training data
... |
classdef ConfigurationTree < handle
properties
pStore % 2-d matrix. Row = configurations. Row 1= root. Columns = Number of candidate gerators for that configuration
indexMap %Keys = string representation of configuraton + year, values = index of that configuration in pStore
yearlyConfigu... |
function[projection_oct]=projection_oct(d3)
%d4=d3(160:550,:,:);
% d3=d3_register;
[v1,v2,v3]=size(d3);
s=zeros(v3,v2);
% s1=d3(:,:,76);
% s1=d4(:,:,1);
% s1=uint8(s1);
%imshow(s1(160:550,:),[]);
% s2=d3(1,:,:);
% figure
% imshow(uint8(s2))
for k=1:v3
s1=(d3(:,:,k));
%s1=uint8(s1);
s2=sum(s1)./v1;
% s2=uint8(s... |
function [G, U1, U2, U3] = hosvd(X, n1, n2, n3)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
Us = cell(1, 3);
n = [n1 n2 n3];
for i=1:3
S = razpri(X, i);
[U, Sigma, V] = svds(S, n(i));
Us{i} = U(:, 1:n(i));
end
G = zmnozi(zmnozi(zmnozi(X, Us{1}',1), Us{2}',2), Us{3}', 3);
... |
tic
% clear_all_but NMSD_x NMSD_y A pName fNames;
delete output1.mat;
delete output2.mat;
delete output3.mat;
delete output4.mat;
%lambda=(1*10^-6)/(6*pi*2.5*10^-6*0.896*10^-3);
lambda=(1.38064852*(10^-23)*293.15)/(pi*0.5*10^-6);
%AR=33;%Aquisition rate
AT=MSD(end,1);%Recorded time
AR=numel(MSD(:,1))/AT;%Aqui... |
function [ AbhhHat0,cout] = mySSD2_2( yy,W,N1,N2,L,maxNum )
cout = 0;
yytemp = yy;
ppos = [];
maxDis = ceil((maxNum-4)/8);
for ss = 1:L
qq = zeros(N1-1,1);
for q = 1+maxDis : N1-1-maxDis
Wq = W(:,(q-1)*N2+1:(q+1)*N2);
qq(q) = norm(Wq \ yytemp);
end
[~,sq] = max(qq);
... |
% M = [
% -691 -585 593 212 733;
% -331 -308 342 -82 138;
% 56 -79 -778 27 267;
% -134 400 -139 -758 -418;
% 704 -435 428 642 -743];
M = [
894 207 -248 -269 -281;
207 646 -42 -42 464;
-248 -42 970 225 -15;
-269 -42 225 174 -5;
-281 464 -15 -5 917
];
% M = [4 1 0;... |
% P2.2.2: x2(n) = gaussian{10,10}
clc;
n2 = [1:10000];
x2 = 10 + sqrt(10)*randn(1,10000);
[h2,x2out] = hist(x2,100);
bar(x2out,h2);
xlabel('interval');
ylabel('number of elements');
title('Histogram of sequence x_2(n) in 100 bins');
% nhan vector thi .*stepseq |
if vel(j,1) <= 15
Bvj(j,1) = max_brake;
end
if vel(j,1) > 15
Bvj(j,1) = max_brake - (1000*(vel(j,1)-15));
end
Bvj(j,1) = Bvj(j,1)*1;
accj(j+1,1) = Bvj(j,1)./mass;
if accj(j+1,1) < max_decel
accj(j+1,1) = max_decel;
end
% i = j+100;
% Rv_B(i+1,1) = Dav... |
%{
# Segmentation of functional movies
-> pni.CorrectedScan
-> pni.SegmentationTask
-----
segmentation_time=CURRENT_TIMESTAMP: timestamp # automatic
%}
classdef Segmentation < dj.Computed
methods(Access=protected)
function makeTuples(self, key)
%!!! compute missing fields for key here
self.inse... |
% DKest = [(2*pi*10)^2 0; 0 1^2];
% H = [1 0]; % это вектор-строка
% G = [0; 1]; % а это вектор-столбец
% for j1 = 1:6000
% DKextr = Ff*DKest*Ff' + G*G'*Dksi;
% DKest = inv(inv(DKextr) + H'*H*(1/DekvW));
% end
% KalmanFLL.setKoeff(DKest*H'*(1/DekvW));
% KResFLL.DteorW = DKest(1,1);
% KResFLL.DteorV = D... |
classdef LM_LeftPaneListElementBase < LM_UnitBase
properties (GetAccess = ?LM_UnitBase, Constant)
listItemHeight = 25; % Also serves as icon width
leftSpacer = 10;
rightSpacer = 10;
end
properties (Access = private)
displayName = '';
isActive = false;
gHBox;
gIcon;
end
methods... |
function [HYPR,FBP] = HYPR_recon(npr,inter)
% DESCRIPTION: Implementation of the HYPR reconstruction algorithm
% described by Wieben et al.
% INPUTS:
% npr = number of projections per interleave
% inter = number of interleaves (time frames)
% OUTPUTS:
% HYPR = HYPR reconstructed ti... |
% Produces data for figure S5.
% How does the geodetically constrained core density and moment of inertia
% compare to the geochemically predicted?
% Figure 3, part a: geodetic constraints.
lib_amp_Bertone_2021 = 39.03;
dlib_amp_Bertone_2021 = 1.1;
[C_m, dC_m] = fn_get_C_m(lib_amp_Bertone_2021, dlib_amp_Bertone_20... |
%
% dotProduct = getDotProduct(vec1, vec2)
%
% @param vec1
% one vector which you want to compute dot product
% @param vec2
% another vector which you want to compute dot product
% @return dotProduct
% dot product of vec1 and vec2
%
function dotProduct = getDotProduct(vec1, vec2)
dotProduct = s... |
clc
clear SPSD;
load('Removed_Function_Index.mat');
%% Find the bit combinations (states) of input bits
%input simulation
%% ABC
SPSD(1).Initial_State_str = '011';
SPSD(1).Target_State_str = '0';
SPSD(1).Perturbed_Input_index_str = '';
%Give the Boolean function index to get the output states (Target_Output[1] an... |
%*****************************************************************
% Description: The best run selection by combining cross-run averaging and a one-sample t-test
% Usage:
% [cSm, pSm, r, in] = bestRunSelection(cS,pS,mask_ind,alpha)
% Input:
% cS: the corrected spatial map estimate with dimension 1 x V.
... |
function [u, branch1, branch2, iters, vals] = get_uk(A, B, u)
[n, ~] = size(A);
W = A*B+B*A;
W = (W+W')/2;
A = (A+A')/2;
B = (B+B')/2;
if (nargin == 2 || norm(u) <= 10e-10)
[u1, ~, ~] = eigs(W, 1, 'SA');
[vb_plus, db_plus, ~] = eigs(B, 1, 'LA'); [vb_minus, db_minus, ~] = eigs(B, 1, 'SA');
[va_plus, da_plu... |
% main8a.m demonstration of Gaussian Mixtures
% for regression
% trained by EM on 2D data
%
% (c) Lars Kai Hansen 1999
%
clear
K=150; % Number of clusters
nits=30; % Number of EM iterations
method=1; % Method of initialization 1,2,3
common_sigs=1; % =1 if clusters have common... |
% zmap.m
%
% Contour magnitude and phase of an analytic function f(z) on
% the complex plane. f(z) is given by a matlab M-file, fun.m
% which the user must provide. An example file is provided, which
% can be edited to the user's specifications.
%
% There are several viewing options: see comments in
% solid... |
%**********************************************************************
% This program computes the average BER of a DS-SS/BPSK
% communication system with binary BCH code in the AWGN channel
%
% final11_extra.m
%
%**********************************************************************
%function Pl... |
function dydt = riccati(t, y , Q, R, t_open, x_open, u_open)
%VDP1 Evaluate the van der Pol ODEs for mu = 1
%
% See also ODE113, ODE23, ODE45.
% Jacek Kierzenka and Lawrence F. Shampine
% Copyright 1984-2014 The MathWorks, Inc.
x_0 = interp1(t_open', x_open', t);
A = [0,1; -cos(x_0(1,1)) , -1];
B = [0;1];
S = ... |
%% DemoBrainSpiral
%
% This script loads real scanner data from a spiral MRI experiment. By
% default, precomputed receiving coil sensitivity maps are loaded but the
% code to compute them can be uncommented. The full dataset is first
% processed and a reference image is reconstructed out of it. Then, a
% reduced dat... |
function outCSI = smooth(inCSI, winSize)
%Smoothing CSI sequence through weighted moving averaging algorithm
%Input: CSI Sequence, Window Size
%Output: Smoothed CSI Sequence
[row, column] = size(inCSI);
csi = [zeros(1,winSize), inCSI];
res = 0;
for i = winSize + 1:column + winSize
... |
% arrayProcessing.m
% Dan Hirlinger
% 10/12/2020
clear; clc;
% Digital Summing / "Mixing"
Fs = 48000;
Ts = 1/Fs;
t = [0:Ts:1].';
f1 = 300;
x1 = sin(2*pi*f1*t);
f2 = 1000;
x2 = sin(2*pi*f2*t);
y = x1 + x2;
%plot(y);
% Ring Modulation
% reuse same signals as above
N = length(x1);
y = zeros(N,1);
for n = 1:N
... |
% MERGENTIAWITHHIFLDCELLTX Merge the NTIA randomized U.S. laydown with the
% HIFLD Cell Tower locations.
%
% Yaguang Zhang, Purdue, 03/08/2021
clear; clc; close all; dbstop if error;
% Locate the Matlab workspace and save the current filename.
cd(fileparts(mfilename('fullpath'))); addpath('.');
cd('..'); addpath('lib... |
function can = module_Y2011_CGEA1_2_CMDB_v11_03_PtCAN(uniquemsgid, cantime, msg, b, canchannel, bfname)
%
% Vector Database Message Decoding
%
% Vector dbc File Name: C:\Documents and Settings\selwart\My Documents\My Web\2011 Project\DriveHistory\CANLists\2011Explorer\Y2011_CGEA1.2_CMDB_v11.03_PtCAN.dbc
% Created by db... |
function [p,V,Q,iter,delta] = classic_qlearning(T, R, discount_factor, iterations)
if nargin < 4
iterations = 10000;
end
fprintf('Classic Q-learning\n');
% Useful values
numStates = size(T,1);
numActions = size(T,2);
% Initialization
Q_prev = zeros(numStates, numActions);
Q = zeros(numStates, numActions);
delta... |
function BootStrap = WIPsubfnBootStrap(data,Nboot,FieldNames)
PointEstResults = WIPsubfnFitModel(data);
% initialize bootstrap values based on the size of the results structure.
% FieldNames to bootstrap
%%
BootStrap = {};
for i = 1:length(FieldNames)
Value = getfield(PointEstResults,FieldNames{i});
if iscell(... |
% Hand calcs for simplified umat - 1D shear
clear;
clc;
% Symbolic variables
syms S gam gam_p kap real;
% Material parameters
E_const = 1000;
G_const = 500;
nu = 0.0;
Sy0 = 1;
H = 100;
% Elasticity matrix
C_mat(1,1) = E_const;
C_mat(2,2) = G_const;
C_mat(3,3) = G_const;
% Point A
gam_pA = 0.0;
kapA = gam_pA;
Sy = ... |
% input color image
Im = im2double(imread('./imgs/7.png'));
% Part 1: Basic Decolorization Algorithm
gIm = full(cprgb2gray(Im));
% gIm = CPD(Im);
imwrite(gIm, 'tt.bmp');
% Part 2: Decolorization Evaluation: Color Contrast Preserving Ratio (CCPR)
ccprRes = 0;
for tau = 1:15
ccpr = CCPR(gIm, Im, tau);
ccprRes... |
%note, for this to work
% 1) remove all the stuff before the messages begin, and all the 'val' stuff at the end,
%from the .dbc file you read in. It should just be a list of messages
%2) Make sure theres a whitespace between the last message and the end of
%the file - the last line should be whitespace
clear all;
%som... |
clear
% 環境パスにディレクトリを追加
addpath('libAuxIVA');
fromHz = 44100;
toHz = 44100;
toBits = 16;
FFT_SIZE = 2048;
FFT_SHIFT = FFT_SIZE/2;
fromDir = 'audio_2ch_data';
fromFiles = dir(strcat(fromDir, '/1.wav'));
toDir = 'subspace';
if(exist(toDir, 'dir') == 0)
mkdir(toDir)
end
% ディレクトリ内のすべてのファイルに対して操作を行う
for file = fromF... |
clear;
n=1:100;
k=1:100;
xn(2,:)=cos(0.48*pi*n)+cos(0.52*pi*n);
xn(1,:)=[xn(2,1:10),zeros(1,90)];
N=100;
w=2*pi/N;
for i=1:2
Xk(i,:)=xn(i,:)*exp(-1i*(n'*w*k));
Xabs(i,:)=abs(Xk(i,:));
subplot(2,2,2*i-1)
stem(n,xn(i,:),'black','filled','MarkerSize',4);
xlabel('time');
title('signal')
subplot(2,2,2*i)... |
%% Clear stuff
clear all;
clc
%% PBVS
cam = CentralCamera('default');
T_C0 = SE3(1,1,-3)*SE3.Rz(0.6);
Cd_T_G = SE3(0, 0, 1);
pbvs = PBVS(cam, 'pose0', T_C0, 'posef', Cd_T_G, 'axis', [-1 2 -1 2 -3 0.5])
pbvs.run();
figure
pbvs.plot_p();
figure
pbvs.plot_vel();
figure
pbvs.plot_camera();
%% IBVS
cam = CentralCamera('d... |
function matlab_example_callback()
import com.tinkerforge.IPConnection;
import com.tinkerforge.BrickletHumidity;
HOST = 'localhost';
PORT = 4223;
UID = '7bA'; % Change to your UID
ipcon = IPConnection(); % Create IP connection
h = BrickletHumidity(UID, ipcon); % Create device object
... |
classdef rlModelInstance_jumping < rlModelInstance % < rlModel
% Citations used:
% http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.872.5578&rep=rep1&type=pdf
% https://www.tandfonline.com/doi/pdf/10.3109/17453678208992202
properties
% link length array (linkFrame, previousFrame, pr... |
function [cam_wnr] = wnr_filter(cam_blur_noise,PSF,K)
%Wnr Filter
% We take the inputs as the Noisy Image
% The estimated Blur or PSF
% And estimated K using NSR
cam_wnr = deconvwnr(cam_blur_noise,PSF,K);
end
|
function y = cfo(u, df, dphi)
global FS;
t = (0:length(u)-1)./FS;
osc = exp(1j.* (2*pi*df .* t + dphi));
y = u .* osc';
end
|
% Finds S that minimizes
% || reshape(S) ||_{*}
% subject to
% W = R (S + mu * 1')
%
% where mu is a 3Fx1 centroid trajectory.
%
% Parameters:
% projections
% - num_frames
% - tracks
% - frames
% - equations
% - A, b -- Linear system
function [X, mu] = find_structure_free_translation(projections, use_3P, .... |
function g = Ubrzanje (l, T)
g = 4*(pi^2)*(l/(T^2));
end
|
% Load the pre-rectifed images
left = imread('imLeft.png');
right = imread('imRight.png');
fprintf('Starting matchingWindow matching algorithm');
% Convert the images from RGB to grayscale by averaging the three color
% channels.
leftI = mean(left, 3);
rightI = mean(right, 3);
% DisparityMap 2D matrix i... |
function [ ret ] = meanFreq( mat )
%NOT IMPLEMENTED
ret = zeros(size(mat, 1), 1);
end
|
function img_out = HistoEqualization(img_in)
% get size of image
img_in = double(img_in);
[row, col] = size(img_in);
img_out = zeros(size(img_in));
% construct a histogram
h = zeros(1,256);
x = 0:255; % axis
for r = 1:row
for c = 1:col
h(img_in(r,c)+1) = h(img_in(r,c)+1) + 1;
end
end
h_max = m... |
clear
clc
close all
%读取图片
I = imread('1.bmp');%清晰
if ndims(I)==3
I=rgb2gray(I);
end
I=double(I);%满足卷积运算需要
I1 = imread('2.bmp');%有散焦
if ndims(I1)==3
I1=rgb2gray(I1);
end
I1=double(I1);%卷积运算要求为double
I2 = imread('pic11.jpg');
if ndims(I2)==3
I2=rgb2gray(I2);
end
I2=double(I2);
%得到卷积核
a=ones(5,5)*... |
function [ Lagrange_multiplier ] = Lagrange(L, N, Y, sigma, gamma, model)
% This function is to get the Coefficient matrix in LS-SVM Partial Linearity Estimation of Dynamic model(PLEDM)
% Output:
% The Lagrange multiplier
% Input:
% L : A matrix of linearity independent variable
% N : A matrix of nolinearity indep... |
clf;
domain = 16*pi;
N = 256;
x = domain*linspace(0,1-1/N,N)-domain/2;
f = exp(-(x/3).^2);
% f = 1./(x.^4+1);
% f = exp(-1./(1-(2*x/domain).^2));
% f = sin(4/32*x);
f = f-mean(f);
t_max = 1000;
t_step = 0.001;
count = 0;
df_old = zeros(1,length(f));
df_old2 = zeros(1,length(f));
a = 0;
% a = 0.5;
% a = 1.0;
% a = 1.1... |
function [ V, a ] = vel( k, o, h, F )
% metoda Styrlinga
D = zeros (k,3);
for i=1:(k-1)
D(i,1) = F(i+1) - F(i);
end
for i=1:(k-2)
D(i,2) = D(i+1,1) - D(i,1);
end
for i=1:(k-3)
D(i,3) = D(i+1,2) - D(i,2);
end
V = zeros (k,1);
for k=(o+2):(k-2)
V(k) = (((D(k,1)+D(k-1,1))/2)-(D(k-1,3)+D(k-2,3))/12)/h;... |
function [MirroredNodes,MirroredElements] = MirrorElements(Nodes,Elements,BoundNodesidx,Direction,Offset)
% MirrorElements: Generates full model from quarter model
% INPUTS:
% Nodes : Array containing nodes
% Elements: Cell containing all elements
% BoundNodesidx: Index of nodes that are located on mirror a... |
%% Problem 1 - Smith-Waterman alignment
% Consider two sequences 'GTAATCC' and 'GTATCCG'
% Construct the scoring matrix for this with the parameters:
% match value = 2, mismatch value = -1, and gap penalty = -1. Use your
% solution to get the optimal alignment. If you prefer, it is acceptable to do this with
% pencil ... |
function [X_r,phase]=locating(ABS,n_spin,NNN,PHA)
% [pks,locs] = findpeaks(ABS);
% for ii=length(locs):-1:1
% if pks(ii)<=0.35
% locs(ii)=[];
% end
% end
% locs=[3,104,149,151,153,202,300,301,399,502,504,604,653,698,704,804,854,899,902,952];
locs=[3,104,202,399,604,653,804,854,... |
function initializePursuerEvader(varargin)
%initializePursuerEvader()
%
%This function will initialize pusuerEvader, which is an application
%that will track both a pursuer and an evader.
%It will erase NOT erase any data, simply ensures that you won't get 'out of bounds' errors
global T0 TPLOT
global PURSUER_EVAD... |
function out = mzoom(varargin)
%MZOOM Zoom in and out on a 2-D plot.
% Extra features added to ZOOM:
% 1. Arrow keys translate left & right by a whole screen, '<' and '>'
% translate by 1/20 of a screen width.
% 2. Features added to support multi-axis zooming, in particular
% 'zoom out' needed to become xon... |
function res = speaking_face2_optimize_fmincon(episode_data, cliq_data, optim_params, debug)
%SPEAKING_FACE2_OPTIMIZE_QUADPROG Constrained function minimiation based optimization
%
% Models the problem as a constrained function minimization
% Wraps the fmincon objective function -- speaking_face2_fmincon_objfun.m
% Cal... |
function Y = vl_nnloss(X,c,dzdy,varargin)
% --------------------------------------------------------------------
% % ssim loss by Fang Li,2018-04-04
% --------------------------------------------------------------------
if nargin <= 2 || isempty(dzdy)
load ssimpara
ws = size(gaussFilt,1);
n1 = ws; n2 = ws;... |
function y = sigmoid(x, dzdy)
%SIGMOID Summary of this function goes here
% Detailed explanation goes here
y = 1 ./ (1 + exp(-x));
if nargin == 2 && ~isempty(dzdy)
assert(all(size(x) == size(dzdy)));
y = dzdy .* y .* (1 - y);
end
end
|
% FINAL DEMO interface
%
% This script is meant to be used for communication with the DSP chip
% This opens a serial port to listen (indefinitely) to the DSP chip.
%
%
function FinalDemo
clear all; clc; close all;
%% Stablish serial connection with DSP Shield
baud = 115200;
% comport = 'COM6';
compo... |
% rename odd subject numbers
ct = 1;
for s = 1:2:60
try
load(sprintf('tutorialRevLearn_high_s%03.0f_data.mat',s));
data.prep.sID = ct;
data.subTag = sprintf('tutorialRevLearn_high_s%03.0f',ct);
save(sprintf('tutorialRevLearn_high_s%03.0f_data.mat',ct));
ct = ct+2;
... |
function [ bits ] = decodeQAM( subcarrier_config, symf, QAMsize,scale)
%DECODEQAM Summary of this function goes here
% Detailed explanation goes here
[x y] = size(symf);
bits = [];
if(QAMsize == 1)
bits = symf(subcarrier_config==1) < 0;
return
end
if(QAMsize == 2)
index... |
close all;
clear all;
datapath1='h001';
load(datapath1,'h001');
datapath2='h001diff';
load(datapath2,'h001diff');
datapath3=('h001diffdiff');
load(datapath3,'h001diffdiff');
datapath4=('h001curvature');
load(datapath4,'h001curvature');
x=h001(:,1);
y=h001(:,2);
h=abs(diff([x(2,1),x(1,1)]));
%1st derivative
yapp1=... |
% FILE ID INFO
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ess3_description='6 Ah Saft Li-Ion battery adjusted to 12V';
ess3_version=2003; % version of ADVISOR for which the file was generated
ess3_proprietary=0; % 0=> non-proprietary, 1=> proprietary, do not distribute
ess3_validation=2; % 0=> no validation, 1=> data ag... |
classdef OTFrescale < handle
% OTFrescale class for smoothing input PSFs using a 2D Gaussian filter
% create object: obj = OTFrescale();
%
% OTFrescale Properties (Input):
% PSFs -
% Pixelsize -
% SigmaX -
% SigmaY -
%
% OTFrescale Properties (Output):
% Mod... |
%Parameters: function, min, max, segments
%output : integration, vector, message
function [varargout] = trapezoidal(handle, min, max, sgm)
%assign the handle
f = matlabFunction(evalin(symengine, handle));
Xi = min;
Xu = max;
n=sgm;
%calculate the size of the segments
h=(Xu-Xi)/n;
%cr... |
%--------------------------------------------------------------------------
% BangBang_Solution_Control.m
% Calculates the optimal control for the Bang-Bang problem
%--------------------------------------------------------------------------
% See page 141 of Benson's PhD thesis
%----------------------------------------... |
%heat1Dexplicit.m
%
% Solves the 1D heat equation with an explicit finite difference scheme
% FTCS
% Ts abrupt change
% JSB w/ help from USC code from GEOL557 Jan. 2016
clear all
figure(1)
clf
%% Physical parameters
L = 400; % length of modeled domain [m]
Ts = -6; % Surface T [C]
kappa = 1e-6; % Thermal diffusivity o... |
%use subfunction to find objective minimum using 3-point quadratic Polynomial approximation
function [xmin]=quadmin_3point(X1,F1,X2,F2,X3,F3)
%to find the coefficients
a2=(((F3-F1)/(X3-X1))-((F2-F1)/(X2-X1)))/(X3-X2);
a1=((F2-F1)/(X2-X1))-a2*(X1+X2);
a0=F1-a1*X1-a2*X1^2;
%now the minimum for a quadratic approxi... |
%clc;
%a=hdrread('\HDRimage\HDRimages\memorial_o876.hdr'); a=double(a); %Nsteps=2068
%a=hdrread('\HDRimage\HDRimages_originals\rend05_o87A.hdr'); a=double(a); a=a(1:704,:,:); %Nsteps=2068
%a=hdrread('\HDRimage\HDRimages\dani_belgium_oC65.hdr'); a=double(a); a=a(1:768,1:1024,:); %Nsteps=1808
%a=hdrread('\HDRimage\... |
% phase stability
% data_taking.public.xmon.temp.phaseStability(qubits, delay, DurationInMin)
function phaseStability(qubits, delay, DurationInMin)
import sqc.util.qName2Obj;
import sqc.op.physical.*;
import sqc.util.getQSettings;
import sqc.util.setQSettings;
setQSettings('r_avg',10000);
if ~iscell(qubits)
qubi... |
function[datos_x, datos_y] = redefino_dominio_hexagono(perfil_x, perfil_y, datos_x, datos_y, datos_x_1, datos_y_1, datos_x_2, datos_y_2, punta_x, punta_y, a1, a2, camara)
% esto estaba pensado solo para el trapecio?
% if camara == '1'
%
% if punta_x > datos_x_1(end) + 50 && punta_y < da... |
fromPath = '../../sumMe\videos/';
toPath = '../../staticAttention/';
videos = dir(fromPath);
for i = 2:size(videos,1)
[staticAttention,frCount] = getStaticAttention(strcat(fromPath,videos(i).name));
temp = strcat(toPath,videos(i).name);
newName = temp(1:size(temp,2)-4);
save(strcat(newName,'.mat'),... |
%% STLDEMO shows how to use the functions included in the toolbox STLTOOLS
%% EXAMPLE 1.- How to cut a sphere and close the base to get a semisphere
% load an ascii STL sample file (STLGETFORMAT and STLREADASCII)
[vertices,faces,normals,name] = stlRead('sphere_ascii.stl');
stlPlot(vertices,faces,name);
% the sphere ... |
function [ q, Re ] = calcFlowrate( L, rho, P_wh, mu, D, P_wf, e )
%CALCFLOWRATE calculates single-phase flow-rate in a pipe
% considering turbulent flow and in field units the flowrate is obtained
% via Chen's correlation (1979). Returns flow-rate and the Reynolds
% number.
gc = 32.17;
syms u f
Re = 14... |
figure('name','Ikili Resim Bilgileri Bulma');
img = imread('http://i.imgur.com/5HNPkuP.png');
sz = size(img) % resmin boyutu
unique(img) % resmin içerdigi degerler
cs = class(img) % resmin tipi
imgcopy = img ;
imgcopy(10,:) = 1; %resimde 5.satırdaki matris elemanları beyaza boyandı.
imgcopy... |
function x = emailFeatures(word_indices)
%EMAILFEATURES takes in a word_indices vector and produces a feature vector
%from the word indices
% x = EMAILFEATURES(word_indices) takes in a word_indices vector and
% produces a feature vector from the word indices.
% Total number of words in the dictionary
n = 1899;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.