text stringlengths 8 6.12M |
|---|
function connectionSend = openSend(host, port)
d = tcpip(host, port, 'NetworkRole', 'Client');
set(d, 'OutputBufferSize', 3000000); % Set size of receiving buffer, if needed.
%Trying to open a connection to the server.
while(1)
try
fopen(d);
break;
catch
fprintf('%s \n','Cant find Se... |
function batchdaysigrams
%BATCHDAYSIGRAMS Summary of this function goes here
% Detailed explanation goes here
% Enable dependecies
initializedependencies;
% Construct project paths
Paths = initializepaths;
extension = '.cdf';
[~,dimPathArray] = searchdir(Paths.editedData.dim,extension);
[~,fhighCctPathArray] = sear... |
% Making Matrices
% provides cunning examples of ways to make matrices
% written IF 1/22/2018
mat1=zeros(5,4)
mat2=mat1;
mat2(1:5, 3)=1
%%
tic
mat=zeros(6);
for i =1:6
mat(i, :)=[-2 0 -1 1 2 3]
pause
end
mat2=mat1;
mat2(1:end, 3)=6
% can also be wrtten as mat2(:, 3)=6
mat2=mat1;
ma... |
function [cx, cy, cs] = detectCorners(I, isSimple, w, th)
% This code is part of:
%
% CMPSCI 370: Computer Vision, Spring 2016
% University of Massachusetts, Amherst
% Instructor: Subhransu Maji
%
% Homework 3
% Convert to double format
I = im2double(I);
% Convert color to grayscale
if size(I, 3) > 1
I ... |
%% Midterm Question 4
% Paul "Nick" Laurenzano
%% Overview
% For the shown RPP robot...
%% A
% Calculate the inverse kinematic equations for the three joint variables
% theta1, d2 and d3, given X, Y and Z. Type them into the window as your
% answer. Save them for the question below.
% Theta(X,Y,Z) = , d2 (X,Y,Z) ... |
function z = Branin(x1,x2)
z = (x2 - 5.1*x1.^2/(4*pi*pi) + 5*x1/pi -6).^2 + 10*(1-1/(8*pi))*cos(x1) + 10;
end |
clc
clear all;
[X,Y] = meshgrid(-20:1:10);
Z=tan(X^2+Y^2); |
function [cost, grad, n1, n5, n10] = MIRNN_cost(theta, input, output, hidden_size, lamda, gc)
theta1 = theta.theta1;
theta2 = theta.theta2;
theta0 = theta.theta0;
input_size = size(input{1}, 1);
output_size = size(output, 1);
batch_size = size(input{1}, 2);
no_loop = length(input);
%% params
% theta1
limi... |
clear
clc
f = [8 10 16 14 10 5 2];
x = [55 65 75 85 95 105 115];
xf = sum(f.*x);
fp = sum(f);
xbar = xf/fp;
fprintf('Mean value of X: %.2f\n',xbar); % mean print
%mean deviation start
a = abs(x-xbar);
b = sum(f.*a);
md = b/fp;
fprintf('Mean deviation: %.2f\n',md); %mean deviation print |
function r = randomSequence(mu, R, N)
% return a sequence of N random numbers on the range
% [mu - R/2, mu + R/2]
% INPUT
% mu : Mean of distribution (scalar decimal number)
% R : Range of distribution (scalar decimal number)
% N : Number of random draws (integer)
% OUTPUT
% r : Random numbers (vector... |
function [PostRotAZ,PostRotEL] = pa_2drotate(azimuth,elevation,Beta)
% [XR,YR] = PA_2DROTATE(X,Y,BETA);
% Rotate matrices X x Y by BETA deg.
%
% See also: PA_ROTATE, PA_ROLL
% (c) 2012 Marc van Wanrooij
% e-mail: marcvanwanrooij@neural-code.com
%% Initialization
[m,n] = size(azimuth);
azimu... |
% Generate initial values for the K
% covariance matrices
function cov = generate_cov(X, K)
cov = zeros(3,3, K);
L_max = max(X(:, 1));
L_min = min(X(:, 1));
l = L_min + (-L_min + L_max)*rand;
a_max = max(X(:, 2));
a_min = min(X(:, 2));
a = a_min + (-a_min + a_max)*rand;
b_max = max(X(:, 3));
b_min = ... |
function [vx, vy] = getSparseFlow(I1, I2, sigma, kappa, theta)
% for simplicity we compute it everywhere, then set to zero at non-corners
% compute flow
[M11, M12, M22, q1, q2] = getMq(I1, I2, sigma);
vx = (M22.*q1 - M12.*q2) ./ (M12.^2 - M11.*M22);
vy = (M11.*q2 - M12.*q1) ./ (M12.^2 - M11.*M22);
% compute Harris ... |
%%
close all
clc
%%
labelFontSize = 20;
ticksFontSize = 20;
lineWidth = 4;
% feature('locale')
%%
% Variables' names:
var_name_list = {'T outer (°C)',... % 1
'dn/dt in (mol/sec)',... % 2
'dn/dt vap, out (mol/sec)',... % 3
... |
function Callbacks_SRC_GUI25(f,C,start_path)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x=C{1,1};
y=C{1,2};
a=C{1,3};
b=C{1,4};
u=C{1,5};
v=C{1,6};
m=C{1,7};
n=C{1,8};
lengthbutton=C{1,9};
widthbutton=C{1,10};
enterType=C{1,11};
enterString=C{1,12};
enterLabel=C{1,13};
no... |
function [unew,vnew]= correction(u_star,v_star,pnew,dx,dy,dt)
unew=u_star;
vnew=v_star;
unew(2:end-1,2:end-1)=u_star(2:end-1,2:end-1)-(pnew(2:end-1,3:end-1)-pnew(2:end-1,2:end-2)).*(dt/dx);
vnew(2:end-1,2:end-1)=v_star(2:end-1,2:end-1)-(pnew(3:end-1,2:end-1)-pnew(2:end-2... |
%%%% SVM Implementation: Question 2 %%%%
%% Train SVM
data=csvread('cancer dataset\Training data.csv',1,0);
data(:,1:end-1)=zscore(data(:,1:end-1));
x =
y =
%% obtaining support vectors and corresponding alpha and y values using SMO
[alpha,x,y] = smo(x,y);
%% Calculate weight vector W and bias
W ... |
function s = machin(m)
%MACHIN Calculate decimals of pi with Machin's formula
% MACHIN(M) gives a string with pi truncated to M decimals
% using Machin's formula: pi = 16*acot(5) - 4*acot(239)
%
% This is a faster but less readable version of MACHIN0.
% Author: Jonas Lundgren <splinefit@gmail.com> 2011
... |
function output = XuReadThorEviWithCropSplitImage(file_name,frame_num,bad_pixel_correct_or_not)
if nargin ==2
bad_pixel_correct_or_not=1;
else
end
crop_idx = XuReadHydraCrop(file_name);
width = crop_idx(3)-crop_idx(1)-1;
height = crop_idx(4)-crop_idx(2)-1;
output = zeros(1024,512,frame_num);
temp = XuReadRawWit... |
function y = frameDiff(previousFrame, currFrame, thr)
% currFrame_ = rgb2gray(currFrame);
% previousFrame_ = rgb2gray(previousFrame);
A = abs(double(currFrame) - double(previousFrame));
y=nnz(A>thr);
y = y/numel(A); |
%--------------------------------------------------------------------------
% Setup files containing the parameters for numerical simulation
% Execute code when changing parameters
%--------------------------------------------------------------------------
param = struct('l1',1,'l2',1,'l3',1, ... % length of the link... |
function MiniBatchIdx = getMiniBatchIdx(FullLength, MiniBatchSize, IsShuffle)
%GETMINIBATCHIDX returns a cell array of indices. Each cell contains
% MiniBatchSize indices. The total number of indices in all cell is FullLength
% IsShuffle determines if the indices are shuffled, else returns sorted
% indices. Assu... |
%%Code tutorial 1.08.2015
load('ac4_inputs_marysol_v3.mat')
h = image(imageAC4); h.associate(annoTruthAC4)
h = image(imageAC4); h.associate(annoCvAC4)
close all
h = image(imageAC4); h.associate(annoCvAC4)
h = image(imageAC4); h.associate(annoTruthAC4)
h = image(imageAC4); h.associate(synTruthAC4)
RAMONSynapse
rp = regi... |
function object=create(object,varargin)
% manage input
Narg=numel(varargin);
assert(rem(Narg,2)==0,'ERROR: unmatched name/value pair');
list=properties(object);
M=numel(list);
for n=1:2:Narg
name=varargin{n};
match=false;
for m=1:M
if strcmpi(name,list{m}) && ~isempty(object.(name))
n... |
tic
format long
numChars = 10;
numIndexes = 1000;
len1 = str2double(input('Enter length of word: ','s'));
smallId = zeros(len1,1);
smallChar = zeros(len1,1);
for i=1:len1
smallId(i,1) = str2double(input('Enter Image id: ','s'));
end
for i=1:len1
ttt = input('Enter character: ','s');
if ttt==101
... |
% ============================================
% Author: Alex Chen
% email: alextpf@gmail.com
% 2014
% ============================================
function OptimizeMesh(verts,tri)
edgeStruct = ContructEdgeStrcut(verts,tri);
newTri = tri;
% draw before and after
DEBUG_DRAW_PART = false;
DEBUG_COLLAPSE = false;
DEBUG_... |
function [output1] = Jdq_AMWorld_LeftPelvisRotation(var1,var2)
if coder.target('MATLAB')
[output1] = Jdq_AMWorld_LeftPelvisRotation_mex(var1,var2);
else
coder.cinclude('Jdq_AMWorld_LeftPelvisRotation_src.h');
output1 = zeros(3, 20);
coder.ceval('Jdq_AMWorld_Lef... |
function res = paperPlot04StraightPipeTheory(param,isSaveFig)
%绘制直管理论模拟实验
if isempty(param)
param.isOpening = 0;%管道闭口%rpm = 300;outDensity = 1.9167;multFre=[10,20,30];%环境25度绝热压缩到0.2MPaG的温度对应密度
param.rpm = 420;
param.outDensity = 1.5608;
param.Fs = 4096;
param.acousticVelocity = 345;%声速(m/s)
param.i... |
function [seq] = CamSeqGen(cam,fps,method);
% CamSeqGen: Generate a movie sequence form a list of view
%
% [seq] = CamSeqGen(cam,dt);
% seq: the sequence to be used by CamSeqPlay
% fps: frame per seconde
% method: interpolation method as used in interp1. default is spline
%
% Olivier Salvado, Case Weste... |
function [projected] = cameraToPixel(points, internalMatrix)
%CAMERATOPIXEL Projects camera point to a pixel point
% Matrix to hold result
projected = zeros(length(points),2);
for i = 1:length(points)
% Use internalMatrix to project to pixels
pixelPoint = internalMatrix * points(i,:)';
% Homogenize and sav... |
function ComputeValidity( tEvent )
%
tEvent.bIsValid = PeopleCounters.AreRawDataValid( tEvent.aafRawData );
%
end % function
|
clear all;
clc;
load('BcRemovedM.mat');
load('depthMap4910.mat');
load('acM2095000.mat');
height = length(depthMap(:,1));
width = length(depthMap(1,:));
figure;
imshow(BcRemovedIm);
%%
rangeRankNs = zeros(1,10);
range = 0.3;
kOffset = 0.3;
for i = 1:height
for j = 1:width
for k = 1:10
if dept... |
function training_model = SMO_binary_linear(training_matrix, training_labels, C)
% SMO_BINARY returns the optimal Lagrange multipliers for the SVM
% optimisation problem, using sequential minimal optimisation (SMO)
% training labels must be +1 and -1, order doesnt matter
% INPUTS %%%%
% training_matrix - for two... |
clear;
N=20;
%%
%parameters initialization
min_in1=-1;
max_in1=1;
c1_in1=0.1;
c2_in1=c1_in1;
c3_in1=c1_in1;
c4_in1=c1_in1;
min_in2=-1;
max_in2=1;
c1_in2=c1_in1;
c2_in2=c1_in1;
c3_in2=c1_in1;
c4_in2=c1_in1;
min_out=-15;
max_out=15;
c1_out=c1_in1;
c2_out=c1_in1;
c3_out=c1_in1;
c4_out=c1_in1;
para_in=[min_in1 max_in1 ... |
function RRE( A, b, fid, sas, format )
% RRE performs Reduced Row Echelon form and writes the output to LaTeX code
%
% INPUTS:
% A - an n x m matrix to reduce
% b - (optional) the augmented n x p matrix
% - default is []
% fid - (optional) the file id to write a LaTeX file to
% - default is 1 (standard... |
function [cI] = cropIR(im)
% This function allows you to crop a square of the image of
% the hand according to the points drawn.
% Grayscale
I = rgb2gray(im);
% Find corners of the square
[C1,C2,C3,C4] = searchCorner(im);
% Transform the two images (RGB and NIR) so that the points form a square.
movingPoints = [C... |
%read data
root = "./data";
experiment_names = {"test3","Mat10|100_1000_0.1_0.5","Mat0|1000_10000_0.1_0.5"};
experiment = root + "/" + experiment_names{1};
[nb,nf,mi,me,m,n,Ae,Ai,be,bi,c] = dataRead(experiment);
%parameter for outer iterations
rho = 1;
tol = 1e-10;
%tau = 0.5*(1 + sqrt(5));
tau = 1;
sigma = tau*rho;
%... |
clear all; close all
%clock
%Echointegration file containing only classified data
%Echointegration_FISH_Path='C:\Users\garyr\Desktop\JulieHD\cruze\Test_TS\Cruise_CruiseName_newTest\Treatment20190509_175138\CleanResults\Echointegration\Echointegration_FISH\Echointegration.mat';
[baseFileName, folder] = uigetfile(pwd,'S... |
function result = hotspot_overlap(rec, hotspots)
% temp = mean(hotspots(:,1:2), 2);
% hotspots(:,1) = temp;
% hotspots(:,2) = temp;
result(1:length(rec)) = 0;
max_length = max(hotspots(:,1));
move = round(max_length * rand(1,length(rec)));
for j = 1:length(rec)
a = rec(j, 1);
b = rec(j, 2);
if( b < ... |
function vehicle_data = getVehicleDataStruct()
% ----------------------------------------------------------------
%% Function purpose: define a struct containing vehicle data.
% All parameters refer to the vehicle Chimera Evoluzione
% ----------------------------------------------------------------... |
function [ calib ] = Test4NavCam( scansTimeRange, dataset )
%% load sensor data
CalibPath(true);
%make sure to read in cameras last (due to issue with how I compensate for scale)
sensorData = LoadSensorData(dataset,'Nav','Cam1');
%% run calibration
[sensorData, offsets, varOffsets] = CorrectTimestamps(sensorData, 100... |
function [error_train, error_val] = ...
learningCurveRandom(X, y, Xval, yval, lambda)
%LEARNINGCURVERANDOM Generates the train and cross validation set errors needed
%to plot a learning curve
% [error_train, error_val] = ...
% LEARNINGCURVERANDOM(X, y, Xval, yval, lambda) returns the train and
% cros... |
function [ y ] = sigmoid( X )
y = zeros(length(X),1);
y = (1.0)./(1.0+exp(-X));
|
%% Mass string example and explanation of Matstab
%% Define the system d2xdt+0.2dxdt+1.01x=0
A=[0 1
-1.01 -.2];
[V,D]=eig(A);
V1=inv(V);
%% Calculate dr and frequency
lam=D(1,1);
sig=real(lam);
w=abs(imag(lam));
fd=1/2/pi;
dr=exp(sig/fd);
%% Calculate
x0=[1 -.1]';
t=0:.01:10;
N=length(t);
X=nan(2,N);
for i=1:N,... |
clear;
clc;
a = imread('child2.jpg');
r = size(a,1);
c = size(a,2);
ah = uint8(zeros(r,c));
n = r*c;
f = zeros(256,1);
pdf = zeros(256,1);
cdf = zeros(256,1);
cum = zeros(256,1);
out = zeros(256,1);
for i=1:r
for j=1:c
value = a(i,j);
f(value+1)=f(value+1)+1;
pdf(value+1)=f(value+1)/n;
... |
function [nosilence] = silence(SIG)
th = .10;
tmpsig = SIG/max(SIG);
sth = (abs(tmpsig)>th);
N = length(tmpsig)
for i = 1:N
if(sth(i) == 1)
sigstart = i;
break
end
end
sigstart
sig = SIG(sigstart:end);
sth = sth(sigstart:e... |
J=jet;
%%
load('A.mat','A','cut')
S=cut.grids.ssh;
lat=cut.grids.lat;
%%
clear cut
SS=S-min(S(:));
SS=SS/max(SS(:));
clf;fig=ppc(flipud(SS));
caxis([0 1])
%%
%%
for ee=1:1:numel(A)
iiqq=A(ee).isoper;
RR=A(ee).area.RadiusOverRossbyL ;
x=A(ee).coordinates.exact.x ;
y=A(ee).coordinates.exact.y ;
% text(x,y,spri... |
function [Mcomplex] = AixTOM_readFile(filename)
fid = fopen(filename, 'r');
% if (fid == -1)
% mag = 0;
% phase = 0;
% else
%tline = fgetl(fid);
%fgetl(fid);
%mag = fscanf(fid, '%d', 1);
%phase = fscanf(fid, '%d', 1);
header = fscanf(fid, '%d %d %d %d %f',5); %7 in prior version
patternid = heade... |
% MUSI 6202 HW4 - Dynamic Range Control
% CW @ GTCMT 2015
% objective: implement a limiter according to Fig 7.8 p232. (Zoler 2008)
% y = myDynamic(x, fs, LT, LS, ta, tr, tm, 'levelMethod')
% x = float N*1 vector, input signal
% ta = float, attack time (ms)
% tr = float, release time (ms)
% tm = float, averaging time (... |
%===============Data Scanning=================%
% ensure the csv file is in the same directory
function [interested2] = scanning(state,percent)
M_data = csvread(strcat(state,'.csv'));
%M_data = csvread('FL.csv');
data_size = size(M_data,1);
num = int8(0.1*data_size); % number of points interested
... |
classdef vstar_threshold < handle
properties
items=struct('transition_variable',{},'transition_description',{},...
'type',{},'controlled',{},'threshold_priors',{});
end
properties(Constant)
threshold_list={'exponential','logistic','logisticn','logistic2'}
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2012-2014 Analog Devices, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% h... |
psi_star_omega_map_half(:,:)=psi_star_2D_evol_lin(round(frame_rank_next/10)+1,:,:);
% Using symmetry to reconstruct a poloidal turn
% psi_star_omega_map_rank=zeros(size_r,NB_THETA);
psi_star_omega_map_rank(:,1:round(0.5*NB_THETA))=psi_star_omega_map_half(:,:);
psi_star_omega_map_rank(:,round(0.5*NB_THETA):NB_THETA... |
clear; clc; close all;
L = 1;
n = 100;
h = L/(n+1);
T = 4;
nT = 500;
dt = T/nT;
r = (dt/h)^2;
% assert(r<=1);
A = spdiags(ones(n,1)*[-r 4+2*r -r], -1:1, n, n);
B = spdiags(ones(n,1)*[2*r 4*(2-r) 2*r], -1:1, n, n);
x = (0:h:L)';
u = zeros(n+2,nT);
u(:,1) = sin(2*pi*x)*0;
% v = 2*pi*sin(2*pi*x);
... |
function [Mask]=CreateMasks(frame,borderMask)
posesperImage=16;
%% Mask to remove bone caps
Y=frame/max(frame(:));
Y(Y>0.03)=0;
Y(Y>0)=1;
SE = strel("disk",1);
Y=imopen(Y,SE);
% figure(3);
% imshow(Y);
boneCapMask=imcomplement(Y);
SE = strel("rectangle",[5,70]);
boneCapMask = imerode(boneCapMask,SE);
... |
function nsubplotst(X,Y,ttl)
ax = nsubplots(X,Y);
title(ax(1),ttl);
set(gcf,'name',ttl);
return
|
function predictions = predict_tree(tree,features)
% features = features(:,tree.selectedFeatures);
numInstances = size(features,1);
features = [features, ones(numInstances,1)];
numLabels = tree.numLabels;
predictions = zeros(numInstances,numLabels);
for i = 1:1:numInstances
featuresInstance = features(i,:);
... |
function y = objfunc(x, A, b, lamda, L,lambda1,T)
y = yf(x, A, b, L, lamda) + yh(x, lambda1, T);
end |
%% Reset
fclose('all');
close all
clear
clc
%% Dependecies
[githubDir,~,~] = fileparts(pwd);
d12packDir = fullfile(githubDir,'d12pack');
addpath(d12packDir);
%%
f300 = '\\root\programs\Light-and-Health\IAI_CircadianMonitoringAndRegulation\CMR2-Exp1-Data\300-43DF\43DF_2017_01_11_10_06_04_archive\pacemaker.csv';
f301 =... |
%%%
% assumes roi_stats, stats, and fig stats are loaded in
ext='lib';
filewrite=true;
[opts,dirs]=stan_preflight;
load(fullfile(dirs.agg_dir,dirs.datastore_dir,['mu_ca_timecourse-' ext '.mat']))
%load(fullfile(dirs.agg_dir,dirs.datastore_dir,['cadata_stats_roi_new-' ext '.mat']))
load(fullfile(dirs.agg_dir,dirs.dat... |
% Matteus Legat %
function A = pivotParcial(n, k, A)
A;
[MAX, i] = max(abs(A(k:n, k)));
i += k - 1;
aux = A(k, :);
A(k, :) = A(i, :);
A(i, :) = aux;
end |
function MnsWith2stdErr(A,xlm)
mu = mean(A); % bin means
stder = std(A)/sqrt(size(A,1)); % standard errors
b = 1:size(A,2);
figure
errorbar(b,mu,2*stder)
xlabel('Successive 25 ms Bins')
ylabel('Mean # Spikes +/-2 std er')
xlim(xlm) |
function [transmitMat,compParam] = lz77(inputVar,windowType,windowSize)
%Author : Vishnu Muralidharan A25208488
% Dept. of Electrical Engineering,
% Univ. of Alabama in Hutsville
% Done for EE 610:Digital Signal Compression
% A Sli... |
function final_image = find_displace(base,edit)
%this function finds the displacement vector for the edit image compared
%to the base image using the SSD method
min_ssd = sum(sum((base - edit) .^2));
for x_off = -15:15
for y_off = -15:15
displace = [x_off y_off];
edit_new = circshift(edit, displace... |
function V = Value_Function(agrid,Cons,Hours,par)
% Compute value function at grid nodes
%% Final age
age=MaxAge ;
for ai=1:na
for zi=1:nz
for lambdai=1:nlambda
for ei=1:ne
if (sigma==1.0)
V(age, ai, zi, lambdai, ei) = log(Cons(age, ai... |
% create scales
numOctave = 8;
numVoices = 32;
s0=1;
a0=2^(1/numVoices);
scales=s0*a0.^(0:numOctave*numVoices);
% 4 coefs to 1 coefs ,72 frame to 18 frame
for V=100:300
for H=200:400
% ������x ���������.(��˹ȡ��)
MeanSignalCount = floor(fileCount/4);
% ��������ȡ��
... |
% RIESZCONFIG class of objects characterizing 2D Riesz-wavelet transforms
%
% --------------------------------------------------------------------------
%
% Part of the Generalized Riesz-wavelet toolbox
%
% Author: Nicolas Chenouard. Ecole Polytechnique Federale de Lausanne.
%
% Version: Feb. 7, 2012
classdef RieszCon... |
function [ y ] = downSampler( x,m )
%DOWNSAMPLER downSampler
% [y] = DOWNSAMPLER(x,m)
% x: (in) Senal a decimar
% m: (in) Factor de decimacion, se descartan una de cada M-1 muestras
% y: (out) Senal decimada SIN filtrado LPF
%
% La funcion DOWNSAMPLER toma la senal de analisis x y la decima por un
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function dbFnCoOccurencesHistoMarginals(imgPath, imagesBasePath, outputBasePath, annotation, varargin)
% Computes the co-occurences of colors in an image. Saves the results
% (2-D prob. density in a .mat file)
%
% Input parameters:
%
% -... |
% This program do extract signal object from the image.The signal object
% use to sample.
% fileFolder=fullfile('E:\Matlab│╠đ˛');
% dirOutput=dir(fullfile(fileFolder,'*.bmp'));
%
% for i=1:2
%
% fileNames={dirOutput(2).name}';
% fileFolder=fullfile('E:\Matlab│╠đ˛');
% imshow(fileNames)
% pause(0.... |
function [beta,error,sterrbeta,R2,tstat,param,varbeta]=ordleast(Y,X)
% Computes Ordinary Least Squares projection of Y on X.
%----------------------------------------------------------------
L=length(X(:,1));
% Adds a column of ones to variable matrix, which will estimate the
% constant.
K=[ ones(L,1) X];
... |
%% Projector
% This code projects all the slices into one by adding up all the slices of the
% image
% It is important to know that this codes projects everything X-Z and Y-Z planes.
% Based on the application you should pick which one you like
clear
clc
resmapled_images_path = ' location of resampled images';
pr... |
clear
clc
syms cx cy px py qx qy rx ry lambda mu
%cx - px = lambda*(qx - px) + mu*(rx - px)
%cy - py = lambda*(qy - py) + mu*(ry - py)
soln = solve(px - cx + lambda*(qx - px) + mu*(rx - px), ...
py - cy + lambda*(qy - py) + mu*(ry - py), lambda, mu);
disp('lambda')
pretty(simple(soln.lambda))
disp(... |
function [M ,tetta2]= MReflectance(N1, N2, tetta1)
%MReflectance return M matrix of border between 2 mediums
% N1 - complex refractive index of first medium
% N2- complex refractive index of second medium
% tetta1 - angle of incident
% tetta2 - angle of refraction
% M - M-matrix
[S, tetta2] = SReflectance(N1, N2, tett... |
clear, clc, clf
%load('threes.mat')
load threes -ascii
%% Construct the mean three
clc, clf
colormap('gray')
three_mean = mean(threes, 1)
imagesc(reshape(three_mean,16,16),[0,1])
%% Plot eigen values
threes_zero_mean = threes - mean(threes, 2);
covariance_matrix = cov(threes_zero_mean);
[V,D] = eigs(cov... |
function printInputs(c,f,k,kappa,VolQ,a,d,M,P,alpha,N,n,n0,u0,p,h)
% Display the inputs arguments of wave scattering problem
str = '';
str = strcat(str, sprintf('\nSpeed of light in optics: %e',c));
str = strcat(str, sprintf('\nFrequency in optics: %e',f));
str = strcat(str, sprintf('\nWave number k = 2pi/lambda: %f',... |
function plot_example_PSTH(U ,touch_struct, units_to_plot)
tuned_units = find(cellfun(@(x) x.is_tuned==1,touch_struct.pole));
touch_window = -25:50;
chunks = 3;
figure(20);clf
colors = [.5 .75 .1];
for g = 1:length(units_to_plot)
selected_unit = tuned_units(units_to_plot(g));
motors = normalize_var(U{sele... |
function [theta,axis] = dq2rot(dq)
% DQ2ROT extracts the rotation axis and angle of a rotation dual
% quaternion
%
% [THETA,AXIS] = DQ2ROT(DQ) returns the rotation angle, THETA [deg],
% and the rotation axis, AXIS, of a rotation dual quaternion DQ.
% - DQ is a rotation dual q... |
function varargout = gui_overlay_images(varargin)
% GUI_OVERLAY_IMAGES M-file for gui_overlay_images.fig
% GUI_OVERLAY_IMAGES, by itself, creates a new GUI_OVERLAY_IMAGES or raises the existing
% singleton*.
%
% H = GUI_OVERLAY_IMAGES returns the handle to a new GUI_OVERLAY_IMAGES or the handle to
% ... |
% -------------------------------------------------------------------
% ----------------------- half time step ----------------------------
% -------------------------------------------------------------------
v_X_prev=v_X;
v_Z_prev=v_Z;
v_phi_prev_prev=v_phi_prev;
v_phi_prev=v_phi;
... |
function e = MSE( y, s )
% Mean Square Error
% y - Original image
% s - de-noised image
[m n ~] = size(y);
y = double(y);
s = double(s);
e = sum(sum((y-s).^2))/(m*n); |
function y = dup2(x)
n = length(x);
y=0;
for i = drange(1:floor(n/2))
y = y + 2*str2double(x(i))*str2double(x(n-i+1));
end
if mod(n,2)~=0
y = y + str2double(x(ceil(n/2)))*str2double(x(ceil(n/2)));
end |
function [p] = discrete_normal_alt(x,mu,sigma)
% Creates equally spaced approximation to normal distribution
% x is the grid
% mu is mean
% sigma is standard deviation
% f is the error in the approximation
% x gives the location of the points
% p is probabilities
n = length(x);
if n==2
p = 0.5.*ones(n,1);
elseif n... |
function [ scale ] = getScale( method, varargin)
%getScale returns the scale
% method -
% -------------------------------------------------------------------------
% 'original' - returns the conformal distortion per vertex,
% averaged over the adjacent faces according to
% ... |
stt=3; %starting
stp=8; %ending
a1 = 1; %amplitude
res=0.01; %resolution
b1 = stp-stt;
x = 0:res:10;
f = @(xi,a,b) a*rectpuls(xi,b);
plot(x,f((x-stt)-((b1/2)),a1,b1),'b--');
%Author: Nasimul Amin
%Date:31/12/2018 |
n=0:20
t=abs(10-n)
stem(n,t) |
function k=get_dcnodes
%get_dcnodes
%
%k=get_dcnodes
%Hämtar noderna i fallspalten
%Pär Lansåker, Forsmark, 1995-02-02
%Rev:
global geom
k = geom.nin(1):geom.nout(2);
|
% initZNB_wide_fast
% assumes bw and # of points etc. are already good
znb2.power(0);
f_start = 100e3;
f_stop = 9e9;
f_range = f_stop - f_start;
znb2.frange(f_start, f_stop);
|
function vw=toon_plotCoverage(vw, method, cothresh, prf_size,nboot,nrows,ncols);
%
% function toon_plotCoverage(vw, method, cothresh, prf_size nboot, nrows, ncols);
% plots coverage of multiple ROIs loaded to a gray view (vw)
%
%
% if method, cothresh and nboot not defined Defaults are as following
% method='max';
... |
function [p] = SoftPred(w,X)
sample = size(X,1);
for i = 1:sample
Z(i,:) = X(i,:)*w;
end
[maxz,tc] = max(Z,[],2);
tc = tc-1;
p = tc;
end |
%reading an image
image = imread("cameraman.png");
[R , C] = size(image);
figure; imshow(image); title('Original Image');
%ploting with imhist
figure; plot(imhist(image)); title('Histogram');
%
for i = 1 : R
for j = 1 : C
%as gray levels from the very start are our target
if( image(i , ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2012 Analog Devices, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http:/... |
figure;
N=10000;
mu = 2;
sigma = 3;
ax1 = axes();
ax2 = axes();
Y=zeros(1,301);
k=0;
for i=-15:0.1:15
k=k+1;
Y(k)=gaussienne(i);
end
x = -15:15;
y = mu +sigma*randn(1,N);
hist(ax1,y,x)
plot(ax2, [-15:0.1:15], Y, '-r');
set(ax2,'XTick',[],'XTickLabel',{''},'YTick',[],'YTickLabel',{''},'Color','none');
%Ent... |
% This function adds a f(x)=x line to the plot
function Pej_Add_IdentityDiag(Color)
if nargin==0
Color = 'k';
end
hold on
x = min([xlim ylim]);
X = max([xlim ylim]);
plot([x X], [x X], 'color', Color);
xlim([x X])
ylim([x X])
end |
function [X, Y, Z] = centralDifferencePoisson(stepSize, domainMatrix, rhs)
% Solve poisson equation with domain given by unit squares in
% matrix. The differential equation is then represented by a
% matrix system of equations to solve.
% Number of steps
steps = round(1 / stepSize);
% Expand domain using the ... |
function varargout = grSimplifyBranches(nodes, edges)
%GRSIMPLIFYBRANCHES Replace branches of a graph by single edges.
%
% [NODES2 EDGES2] = grSimplifyBranches(NODES, EDGES)
% renvoie une version simplifiee d'un graphe, en ne gardant que les
% points multiples et les aretes reliant les points multiples.
... |
function [ states ] = BuildStateList
%BuildStateList builds a state list from a state matrix
% state discretization for the mountain car problem
xdiv = (0.55-(-1.5)) / 20.0;
xpdiv = (0.07-(-0.07)) / 20.0;
x = -1.5:xdiv:0.5;
xp= -0.07:xpdiv:0.07;
N=size(x,2);
M=size(xp,2);
states=[];
index=1;
for i=1:N
fo... |
# Script for image analysis of turbity current video frames
# Required external functions:
# useful_functions script file video grab functions
#
###########################################################################
# MANUAL INPUT PARAMETERS
pkg load image
FONTSIZE = 24; # this seems about O... |
function par = parity(packet)
num_ones = 0;
for i = 1:size(packet)(2)
if packet(i) == 1
num_ones = num_ones + 1;
end
end
if (mod(num_ones,2) == 0)
par = 0;
else
par = 1;
end
end |
% assign data arrays to physical channels
% Todo: select the entries that are not "NAN"
function [curr, time, temp] = data_select(raw_data, lines)
curr = raw_data{1,1};
curr = transpose(curr(1:lines,:));
temp = raw_data{1,3};
temp = transpose(temp(1:lines,:));
time = raw_data{1,2};
time... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.