text stringlengths 8 6.12M |
|---|
function nev = loadNev(datadir)
nev1 = load(fullfile(datadir, 'Ro150129_s86a_FreeViewPic_0001_nev'));
nev2 = load(fullfile(datadir, 'Ro150129_s86a_FreeViewPic_0005_nev'));
nev1 = nev1.nev;
nev2 = nev2.nev;
nev2(:,3) = max(nev1(:,3))+nev2(:,3);
nev = [nev1; nev2];
end
|
function plotMaskingCategoryCorrelations(modelHumanCorrelationsPerCategory, humanTimesteps, modelTimesteps)
% accumulate
modelHumanMean = squeeze(mean(modelHumanCorrelationsPerCategory, 3));
% plot
xvalues = humanTimesteps;
yvalues = modelTimesteps;
h = heatmap(xvalues, yvalues, modelHumanMean');
h.XLabel = 'human SOA... |
% 2020-07-08 --- Atlanta
% 2021-03-03 --- Shanghai
% Relaxed Optimized Illumination
% POTF shape Given & Solve, based on numerical Matrix | least square method
% settings of optical cofiguration
rho_o = 1;
rho_c = 1;
% settings of coordinate size
Ma = 500;
Mb = 500;
M = Ma*Mb;
N = 50;
% non-uniform coordinate
a ... |
function pathloss = pathloss_los(sc,hut,d2d,d3d,fc)
%fc in GHz and distance in meters
switch(sc)
case 'RMa'
% selecting rural scenario
if (1.5 < hut) && (hut <= 10)
pathloss = 1 ;
elseif (10 < hut) && (hut <= 300) && (d2d <= 10000)
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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:/... |
function [h, w, nFrames] = tiffDimensions(fPath)
% nFrames = tiffDimensions(fPath) finds the pixel dimensions of a
% tiff file on disk without loading the entire file.
% Gracefully handle missing extension:
if exist(fPath, 'file') ~= 2
if exist([fPath, '.tif'], 'file')
fPath = [fPath, '.tif'];
elseif e... |
function [A,t] = least_squares_affine(pts,pts_tilde)
[A,t] = estimate_affine(pts,pts_tilde);
end
|
function load_file_panel(main_figure,echo_tab_panel)
if isappdata(main_figure,'file_tab')
file_tab_comp=getappdata(main_figure,'file_tab');
delete(file_tab_comp.file_tab);
rmappdata(main_figure,'file_tab',file_tab_comp);
end
app_path=get_esp3_prop('app_path');
file_tab_comp.file_tab=new_echo_tab(main_fig... |
function [dcell, isroi] = run_deconvolution3(ops, dat)
% outputs a cell array of deconvolved spike times and amplitudes.
% Optionally output this in matrix form Ffr (very sparse).
% load the initialization of the kernel
load(fullfile(ops.toolbox_path, 'SpikeDetection\kernel.mat'));
if isfield(dat.stat, 'igood')
... |
x=linspace(0,1,100);
y=cos(2*pi*5*x);
objectA=SMASH.MUI.Line(x,y);
y=sin(2*pi*3*x);
objectB=SMASH.MUI.Line(x,y,'Color','r');
|
classdef linear_eq
properties
vector % element of Xi_vector or small_Xi_vector
constant % array with the number of nodes
end
methods
function w = linear_eq(coefs, const)
% function w = linear_eqs(coefs, const)
if ~isa(coefs,'Xi_vector') && ~isa(coe... |
function [rtDifs stims stims2]=behavAnalysis()
%% Analyze object visual search
%close all
%clear all
%clc
%% Load data
fpath=cd;
fname=fullfile('fullData');
datafile=fopen(fullfile(fpath,strcat(fname,'.txt')));
data =textscan(datafile,'%s %s %f %f %s %f %s %f %f %f %f', 'delimiter',';');
% Shift so starts at 1
data{3... |
function[para,n, errors] = perceptron(eta)
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
data = importdata('TrainingSamplesDCT_8_new.mat');
FG = data.TrainsampleDCT_FG;
BG = data.TrainsampleDCT_BG;
para = zeros(1,65);
training_set = [FG;BG];
y = zeros(1303,1);
y(1:250,1) = 1;
y(251:1... |
% Copyright (c) 2014, ETH Zurich (Switzerland)
% All rights reserved.
function Zoom(hObject, eventdata, dir)
FA = guidata(hObject);
switch dir
case 'in'
FA.pan_zoom('z_in');
case 'out'
FA.pan_zoom('z_out');
case 'actual'
FA.pan_zoom('z_actual');
end
|
function display(obj)
disp([num2str(obj.value) ' +/- ' num2str(obj.error)]) |
function [indice_pai]=roleta(score)
%metodo da roleta matematico
aleatorio = rand;
b_score = score.^8; % aumenta a presão seletiva o correto seria: b_score = score;
if(min(score)<0)
b_score = score-min(score)*1.01; % permite não zerar a probabilidade do pior
... |
function prob = my_gaussPDF(X, Mu, Sigma)
%MY_GAUSSPDF computes the Probability Density Function (PDF) of a
% multivariate Gaussian represented by a mean and covariance matrix.
%
% Inputs -----------------------------------------------------------------
% o X : (N x M), a data set with M samples each bei... |
%This function creates an nX2 vector V of the conncetivity of the circumcenters of the
%Delaunay triangles T with vertices inside segments indicated by M.
## Author: Luis <Luis@DESKTOP-I49GOFE>
## Created: 2017-08-06
function [V] = GetVoronoi (T,M)
EG = [];%This will be a list of n-1 dimensional faces o... |
clear all; close all; clc
featurelabels=[1,2,3,4];
trainfeatures=[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3;
0,0,1,1,0,0,0,1,0,0,0,0,1,1,0;
0,0,0,1,0,0,0,1,1,1,1,1,0,0,0;
1,2,2,1,1,1,2,2,3,3,3,2,2,3,1
];
targets=[0,0,1,1,0,0,0,1,1,1,1,1,1,1,0];
tree=maketree(f... |
function elem=atQuantDiff(fname,varargin)
%atQuantDiff creates a quantum diffusion element
%
%ELEM=ATQUANTDIFF(FAMNAME,DIFFMAT) uses the given diffusion matrix
% FAMNAME: family name
% DIFFMAT: Diffusion matrix
%
%ELEM=ATQUANTDIFF(FAMNANE,RING) computes the diffusion matrix of the ring
% FAMNAME: family nam... |
data = [0 0; 1 1; 2 2; 4 4];
x = data(:,1); y = data(:,2);
figure;
plot(x, y, 'rx', 'MarkerSize', 10);
xlabel('x'); ylabel('y');title('Data Map')
fprintf('Program paused. Press enter to continue.\n');
pause;
m = length(y);
X = [ones(m, 1), data(:,1)];
theta = zeros(2, 1);
alpha = 0.01;
iterations = 1500;
theta = Gr... |
function test_modes_timoshenko
% Test of modes.m subroutine by comparing potentials output with
% those given in Timoshenko and Goodier for a problem with pressure
% applied symmetrically to a part of the boundary: pp215-217,
% Fig125
%---------------------------------
% Input data
%================================= ... |
function project_template(session_dir,subject_name,template_files,hemis,SUBJECTS_DIR)
% Projects anatomical template files in fsaverage_sym space to subject
% native space
%
% Usage: project_template(session_dir,subject_name,template_files,hemi)
%
% Written by Andrew S Bock Feb 2015
%% Set defaults
if ~exist('t... |
scen=3;
if scen >= 4
disp("Valkkaappa joku toinen skenaario")
return
end
save1 = true;
%barcolors = [1, 1, 1; .5,.5,.5; .75,.75,.75; .25,.25,.25];
barcolors = [defaultPlotColors(1).^0.7; .9*defaultPlotColors(2); defaultPlotColors(3); defaultPlotColors(4).^(3)];
if scen == 1
titletxt = "2350 x 1700 mm li... |
%模糊逼近
clc % 清屏
clear all; % 删除workplace变量
close all; % 关掉显示图形窗口
L1=-3;L2=3; % U范围
L=L2-L1; % 模糊集变化范围长度
h=0.2; % 逼近精度
N=L/h+1; %模糊集的个数
T=0.01; %步长
x=L1:T:L2; % 模糊集变化范围
for i=1:N
e(i)=L1+L/(N-1)*(i-1); % 模糊集的边界值
end
c=0;d=0; %初始值
for j=1:N
% 隶属度函数
if j==1
u=trimf(x,[e(1),e(1),e(2)]); %The first MF
... |
classdef RFBConnection < MBUDPConnection
%RFBCONNECTION Implementation of the functions used to controll the
%Schmid RFB over modbus.
methods(Access=public)
function getBatteryVoltage(obj, responseCB)
obj.requestInputRegisterRead(5000, 2, "single", responseCB)
end
... |
function repP = Ei400_uvw110_at10m1TpMod2P(varargin)
root = fileparts(pwd);
data_source= fullfile(root ,'sqw','Data','Fe_ei401.sqw');
bragg = [1,0,-1];
dE = 10;
dK = 0.05;
repPoints1= [-0.29,-0.11,0,0.14,0.34;
90,20,0,20,140];
repPoints2 = [-0.26,-0.08,0,0.2,0.36;
90,30,0,30,140];
repPoints3 = [-0.26,-0.13... |
crossing_points=[];
for ks=-1:0.0001:1
crossing_points = [crossing_points zero_crossing(ks)];
end
ks=-1:0.0001:1;
len=length(ks);
%%
figure();
plot(ks,crossing_points/1000,'LineWidth',3);
hold on;
grid on;
plot(ks,150*ones(1,len),'LineWidth',3)
title('\textbf{The Effect of Coupling Coefficient of Secon... |
function A=MAX_DHEAP_INSERT(A,key,d)
% 函数功能:对max d-ary heap A插入key值元素。
n=length(A);
n=n+1;
A(n)=-inf;
A=DHEAP_INCREASE_KEY(A,n,key,d); |
function varargout = alpseqtool(varargin)
% ALPSEQTOOL M-file for alpseqtool.fig
% ALPSEQTOOL, by itself, creates a new ALPSEQTOOL or raises the existing
% singleton*.
%
% H = ALPSEQTOOL returns the handle to a new ALPSEQTOOL or the handle to
% the existing singleton*.
%
... |
%Input: Matrix
%Description: The difference between the max & min is calculated for each
%row, & the maximum of these values is returned.
%Output: Number
function y=Range_Measure_R_Max(x)
format long
temp=[];
for i=1:length(x(:,1));
temp(i)=abs(max(x(i,:))-min(x(i,:)));
end
y=max(temp);
end
... |
function [ X,Y ] = scale2degree( xViewAngle, xScreenPixels,yViewAngle, yScreenPixels )
%SCALE2DEGREE Returns x and y coordinates properly scaled to visual degrees
% Input parameters:
% xViewAngle: Width of the stimulus in visual degrees
% xScreenPixels: Width of the stimulus in pixels
% yViewAn... |
function data = kickAssSwimDetect01(ch1, ch2)
% Output:
%
% data.swimStartIndT - time indices of where swims start
% data.swimEndIndT - ... where swims end
% data.swimStartT - time series which is 1 where swims start
% data.swimEndT - ... 1 where swims end
% data.burstIndT1 - time indices of burst locations on channel... |
function inds = crossvalidation_indices(X, nfolds)
% Returns a set of data indices to perform k-fold cross validation with a
% given dataset X.
%
% Splits the data into nfolds folds such that inds(i) == k if data point i
% is a member of the kth fold.
fold_size = ceil(size(X,1) / nfolds);
inds = repmat(1:nfolds, 1, f... |
clc
clear
close all
%其实我想在外面定义边界条件,在外面定义区域以及PT矩阵等,因为如果用其他软件
%生成PT矩阵必须从这里就开始导入,边界条件也应该是在这里就定义好然后传给求解器
%这一切都属于用户的需求,都需要放在外面,但PbTb矩阵的形成却涉及到了有限元空间
%的概念,因此需要在内部完成
%初始化各项参数
left = 0; %区间左端点
right = 1; %区间右端点
initial = 0; %初始时刻,终止时刻,时间步长
final = 0.2;
dt =... |
%Завдання 1.3
p1=[1 4 0 3]
p2=[3 5 6 0]
tf(p1,p2)
tf(p2,p1)
clsys1=feedback(tf(p1,p2),tf(p2,p1))
bl3=parallel(tf(p1,p2),tf(p2,p1))
clsys1=feedback(tf(p1,p2),tf(p2,p1))
%Завдання 1.4
disp('поліном')
P=[1 0.3 4.3 0.4]
disp('корені поліномів')
R=roots(P)
disp('перехід від коренів до поліному')
P=poly(R)
%За... |
function ProcessedImage = ImagePreProcessing (Image,DesiredDimension)
%------------------------Silhouette Pre-Processing-------------------------
%
% function ProcessedImage = ImagePreProcessing (Image,DesiredDimension)
%
%This custom method processes the silhouettes extracted from the MoG method
%in order to... |
function skill = skillHarmSinFit(t, x, freq)
% skill = SKILLHARMSINFIT(t, x, freq)
%
% inputs:
% - t:
% - x:
% - freq:
%
% outputs:
% - skill:
%
%
%
%
% Olavo Badaro Marques, 20/Mar/2017.
%%
imf.power = [0, 1];
imf.sine = freq;
[dnew, xnew] = sliding_harmonicfit(t, x, wnd, slidestep, im... |
function [Y,t] = block_rms(X,n,nov)
% [Y,t] = block_rms(X,n,nov)
% Compute the RMS (root-mean-square) of successive blocks of samples.
%
% Inputs:
% X is a vector or a matrix containing samples of a signal in each column.
% n is the number of samples from X to use in each analysis block.
% nov is t... |
function q = qmul(u,v)
% multiply two arbitary quaternion u, v
% u = [w x y z]
% v = [a b c d]
% u*v = [wa-xb-yc-zd, wb+xa+yd+zc, wc-xd+ya-zb, wd+xc-yb+za]
%q = [u(1)*v(1)-dot(u(2:4),v(2:4)), u(1)*v(2:4)+v(1)*u(2:4)+cross(u(2:4),v(2:4))];
q = [u(1)*v(1) - u(2)*v(2) - u(3)*v(3) - u(4)*v(4),...
u(1)*v(2) ... |
function h_nsf = left_toe_ground_reaction_force(robot)
% left toe ground reaction force
GRF = robot.Inputs.ConstraintWrench.fLeftToeBottom;
h_nsf = UnilateralConstraint(robot, GRF(3), 'leftToeGroundReactionForce', 'fLeftToeBottom');
end
|
function mark_FC_peaks(x,FC_pkmax,FC_pkloc)
hold on;
for i = 1:length(FC_pkloc)
plot(x(FC_pkloc(i)),FC_pkmax(i),'color','r','marker','x');
end
end |
function [equilibrium, opinions] = friedkinJohnsen(A, s, tMax, c_eps, varargin)
% friedkinJohnsen - Simulate the Friedkin-Johnsen Model
%
% INPUT:
% [A] = NxN Adjacency Matrix of the Network
% [s] = Nx1 Vector of the Intrisic Beliefs
% [tMax] = Maximum number of rounds
% [c_eps] = Convergence ... |
%%% Parametric for different n, m %%%
error_for_n_m
%%% Parametric for different sampling frequency %%%
error_for_differ_dt
%%% Parametric for different pole for the stable filter (s + theta_m)^n %%%
error_for_differ_pole |
function CheckSpikeArray( nth, Vth_loc, V, V_denoise,V1,V2,loc1,loc2,gt, time )
%UNTITLED5 Summary of this function goes here
% Detailed explanation goes here
% ===== Scaling and offset for easy viewing ========
yscale = 20;
yoffset = -65;
% ==== Orignal signal =====
% figure(1)
% nth = ... |
classdef TuVert < TuSol
% TUVERT is a subclass object of TUSOL to perform several computations for retrieving
% and modifying game data. It stores relevant game information needed to compute all
% vertices of a core/imputation set by overloading functions.
%
% Usage: clv = TuVert(v,'gtype','gformat')
%
% Define varia... |
function [x_S, P_S] = UT_SC(x_C,P_C)
%UT_C2S Unscented Transform from Spherical into Cartesian Coordinates
% UT is required for the covariance transformation
% Inputs:
% Cartesian state vector: q_C = [x y z x_dot y_dot z_dot]'
% Cartesian covariance: P_C
% Outputs:
% Spherical state vector: x_S = [r b e r_dot ... |
%MIT License
%Copyright (c) 2019 Sherman Lo
%CLASS: PLANE MULTIPLY SQUARE
%Produces images which are Gaussian N(0,1) but a square will be N(mu, sigma^2) where the alt
%distribution is dvia the member variables altMean and altStd. This is then multiplied by a
%scalar followed by an addition of a plane.
classdef... |
clc;
close all;
clear all;
t = 0:.1:2*pi;
for k=1:5
offset = k/7;
m(:,k) = t+offset';
end
hSLines = plot(t,sin(m),'Color','b');hold on
hCLines = plot(t,cos(m),'Color','g');
hSGroup = hggroup;
hCGroup = hggroup;
set(hSLines,'Parent',hSGroup)
set(hCLines,'Parent',hCGroup)
% Include these hggroups in... |
clear all
clc
A=imread('a.png');
B=imread('b.png');
halfwinsize=1;
[offsets,distances]=patchmatch(A,B,halfwinsize);
|
function [fluxFlat]=alphaEqnNoUmFluxFlat(uFlat,V0,rhol,rhog,a)
% Gives the flux for alphaEqn in mixture model with no Um term
% u flatten version (u has plain data)
%
% [fluxFlat]=alphaEqnNoUmFlux(uFlat,V0,rhol,rhog,a)
%
% flux: flatten obtained flux
% uFlat: independent unknown in flat form... |
function PDmotor_initSetUp(PsychTool,folder)
% Set up packages and variables for feedback paradigm.
% Call as PDmotor_initSetUp(PsychTool,folder).
% - PsychTool = whether to set up sound in PsychToolbox here (1/0)
% - folder = directory from where to run (default = 'D:\NATMEG PROJECTS\20055_parkinson_motor\matlab_... |
#include "com_codename1_ui_TextArea.h"
const struct clazz *base_interfaces_for_com_codename1_ui_TextArea[] = {};
struct clazz class__com_codename1_ui_TextArea = {
DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FINALIZER_com_codename1_ui_TextArea ,0 , &__GC_MARK_com_codename1_ui_TextArea, 0, cn1_class_... |
classdef WorkerNode < rl.comm.CommNode
% WORKERNODE
% Revised: 10-9-2018
% Copyright 2017-2018 The MathWorks Inc.
properties (Access = private)
HostQueue
WorkerQueue
WorkerID
end
methods
function this = WorkerNode(hostQueue)
% build the worker queue and attach t... |
function [J, grad] = linearRegCostFunction(X, y, theta, lambda)
%LINEARREGCOSTFUNCTION Compute cost and gradient for regularized linear
%regression with multiple variables
% [J, grad] = LINEARREGCOSTFUNCTION(X, y, theta, lambda) computes the
% cost of using theta as the parameter for linear regression to fit the ... |
% cemLaplace01.m
% 18 march 2016
% Ian Cooper
% School of Physics, University of Sydney
% https://d-arora.github.io/Doing-Physics-With-Matlab/
% Solution of Laplace's equation
clear all
close all
clc
tic
% INPUTS ================================================================
% Number of XY grid points (integer)... |
%--------------------------------------------------------------------------
%
% getMeanTraceInt:
% Script that calculates the average total trace intensity and the
% average acceptor trace intensity using manually measured trace
% lifetimes.
%
% Syntax:
% getMeanTraceInt
%
% Inputs:
% 1. The script pro... |
function [xMin, fMin, nIter, info] = descentLineSearch(F, descent, ls, alpha0, x0, tol, maxIter)
% DESCENTLINESEARCH Wrapper function executing descent with line search
% [xMin, fMin, nIter, info] = descentLineSearch(F, descent, ls, alpha0, x0, tol, maxIter)
%
% INPUTS
% F: structure with fields
% - f: function han... |
function Preferences()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%name:Preferences.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%author:luyang
%date:20170120
%function:
%将Algorithm参数保存在preference,方便修改。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%Enhancing%%%%%%%%%%%%%%%%%%%%%%
%check... |
function [columnPoints,inliers]=ransacTest(ims,points,DistanceThresholding,inliersRatio)
Probability=0.99;
MinimumNumber=6;
[rows,columns]=size(points);%number of points
MaxIteration = log(1-Probability)/log(1-(inliersRatio)^MinimumNumber); %the times to choose the best line
pretotal = 0; %the number fits ... |
%@(#) setcross.m 1.1 05/07/13 10:29:39
%
%
%function hcross=setcross(IJ,color)
%function hcross=setcross(I,J,color)
%Input:
% IJ - i and j-index in a n by 2 vector
% i,j- i and j-index in two n by 1 vectors
% color - color (string or rbg-values), default='bla' for black
function hcross=setcross(I,J,farg... |
function [F1_T, pixelPrecision, pixelSensitivity] = F1Measure_(TestImgs, GTImgs)
% Extract TP, FP, TN, FN parameters
[pixelTP, pixelFP, pixelFN, pixelTN] = PerformanceAccumulationPixel(double(TestImgs), double(GTImgs));
% Extract precision, accuracy, specificity, sensitivity
[pixelPrecision, pixelAccuracy, pixelSpeci... |
close all
clear
clc
%%Constants
g = 9.81; %gravitational constant, m/s^2
m_cart = 100; %cart + rider mass, kg
h_start = 6.7056; %Ramp starting height, m
l_end = 35; %Track length
%Track Geometry Constants
b = .055; %1/damping time constant
w = .7; %angular frequency
p = .3;... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Script: CompruebaNorma %%%%
%%%% %%%%
%%%% En esta función se va a generar la matriz %%%%
%%%% de... |
function M_vel = get_M_vel( grid_parms )
%get a diagonal matrix M_vel that converts velocity to flux via
% u = M * q
% (i.e. M has 1/h terms)
%Inputs: grid_parms -- data structure containing m (number of points in x
%dirn), n (number of points in y dirn), mg (number of grid levels), and len
... |
function output = pushNoteViaCurl(ApiKey, device_iden, title, message)
% Push a note by calling curl in system
% https://docs.pushbullet.com/v2/pushes
% Arguments:
% ApiKey -- ApiKey of pushbullet https API
% device_iden -- iden of device to push to
... |
clear all;
close all;
addpath 'D:\matlab_workspace\people_count';
datafilename = 'D:\matlab_workspace\people_count\pHistText_0.csv';
global trackerProcObj;
global outTrackerProc;
data = readPointCloudData(datafilename);
pointCloudSideInfoFromDSP = [];
% cfg.trackerDpuCfg = create_TrackerProc_Config();... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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:/... |
%%%综合程序1(还没有改写成函数形式)对于dicom文件进行排序和结节信息提取
clear;clc;
folder_name_all = uigetdir('');%选择文件夹
%%
filepathlist2 = dir(folder_name_all);
diary 'log1202.txt'
disp(' ');
time=clock;
t1=strcat(num2str(time(1)),'年',num2str(time(2)),'月',num2str(time(3)),'日',num2str(time(4)),':',num2str(time(5)));
disp(['北京时间:',num2str(... |
function M = compute_rotation(v,alpha)
% compute the 3D rotation matrix around vector v
% and with angle alpha.
%
% M = compute_rotation(v,alpha)
%
% Copyright (c) 2004 Gabriel Peyré
v = reshape(v,3,1);
v = v/norm(v,'fro');
S = [0 -v(3) v(2);
v(3) 0 -v(1);
-v(2) v(1) 0];
M = v*tran... |
function [J grad] = nnCostFunction(nn_params, ...
input_layer_size, ...
hidden_layer_size, ...
num_labels, ...
X, y, lambda)
%NNCOSTFUNCTION Implements the neural network cost func... |
% Denna fil är mest tänkt som ett test av CVXgen
%någon random punkt
u10=10;
u20=10;
x10=0;
x20=0;
x30=pi/4;
x40=0;
x50=u10/k1;
x60=u20/k2;
%samplingstid
h=0.1;
[A,B]=linearDescreteModelGen(x10,x20,x30,x40,x50,x60,h);
%setup opt problem
params.A=A;
params.B=B;
params.Q=eye(6);
params.R=eye(2);
params.u_max=10;
para... |
% FILE: Ex3.m
% NAME: LUKE JIANG
% DESCRIPTION: Matlab Plotting Basics
% Clear all variables ans close all windows
clear all;
close all;
% PART A
Fs = 5;
t = -2:(1/Fs):4;
x = 2 - t;
figure;
subplot(1,2,1);
plot(t, x);
xlim([-5 5]);
ylim([-5 5]);
grid on;
xlabel('t');
ylabel('2-t... |
function [ out ] = solveLocation( data )
pointCount = 1;
[dataRow, dataColumn] = size(data);
pointType = 1;
result1 = [];
result2 = [];
result3 = [];
result4 = [];
for i = 1:dataRow
str = data{i,4}{1}(17:strlength(data{i,4}{1})-3);
str1 = strsplit(str,',');
[str1Row, str1Column] = size(str1);
for j = ... |
classdef crd < handle
properties
nr
% crdsteps
pos
konrod
end
methods
function obj = crd(i,fileinfo)
obj.nr=i;
obj.pos=fileinfo.conrodcoor(i,:);
% obj.crdsteps=fileinfo.crdsteps;
... |
function [Reach,RiverData,Metadata,ReachTrue,Nodes,NodesTrue]=ReachAveraging(ReachBoundaries, Dams, StructureFlag ,RiverObs,True,RefRiverObs,RefTrue,Day,SaveResults,SmoothData,VariableSmoothingWindow,OutputPath, OutFileName,MakePlots)
%this function calculates reach-averaged quantities.
%List of inputs
%ReachBounda... |
clc;clear;
%%%%%%%%%This code has run on 24th of April 2021
load data33.mat
load data69.mat
load 'transdata.mat'
% load 'LMPbefore.mat'
% %first we build the matrixes off all systems and then we combine them to a
% %big one
installnode33=[18;22;25;33]
RR33=inv(transpose(M33))*Dr33*inv(M33);
XX33=... |
% CD to folder with US scan, e.g. cd E:\THIFU\Ultrasonix_3DUS_CMIC\10-18-2013-Generic
% and run script
flag2d = false % if true, conversion is just a stack of 2D slices (no real world coordinate system)
d = dir;
hw = waitbar(0,'Please wait');
count = 0;
for i = 3:numel(d)
waitbar(i/numel(d),hw)
if isdir(d(i... |
clear all;
N = 64;
fin=fopen('cam1_64_64.raw','r');
I=fread(fin,N*N,'uint8=>uint8');
ft_Z=reshape(I,N,N);
ft_Z=ft_Z';
im = ft_Z;
imshow(ft_Z);
ft = fft2(im);
ft = [zeros(64,32) ft zeros(64,32)];
ft = [zeros(32,128); ft; zeros(32,128)];
zm = abs(ifft2(ft))
maxi = max(max(zm));
mini = min(min(zm));
... |
simOut = sim('BCM_C1A_EcuMonitor_4') |
function [ data ] = loadLabviewBin(filename, numDims, varargin)
%LOADLABVIEWBIN Load Labview binary file into matlab
%
% DATA = LOADLABVIEWBIN(FILENAME, NUMDIMS)
% Loads the data contained in binary file FILENAME, assuming that it
% is made up of individual blocks, each with NUMDIMS dimensions.
% Da... |
%online adaptive control
%(unit step input)
clear;clc;
totalStep=1000;step1=5;step2=900;
a1=0.3;a2=-0.88;b1=0.9;b2=0.6;%system
Correctalpha1=4.435315;%C(z) design from the real sys.
Correctbeta0=-7.283683;
Correctbeta1=5.821795;
for k=1:totalStep
d(k)=0.01*(rand-0.5);
end
y=[1:totalStep]*0;
u=[1:totalStep]*0;
r=[1... |
load (fullfile('Train2','Train2.mat'));
%%
for i = 1:size(imgResize,1)
LABImage = EF_LabConv(imgResize{i});
%% Quantitize Edge Detection
interval_number = 18; %kuantisasi interval number menjadi 18 bin
EdgeBin= EF_EdgeDetectionLab(LABImage, interval_number);
%% Color Quantitation
% pa... |
clear all
BLOCKSIZE = 48;
FS = 16000;
addpath('../matlab');
% run and write testvector to file
if ~exist('testvectors/matlab','dir')
mkdir('testvectors/matlab');
end
fo0 = fopen('testvectors/matlab/output.f32','wb');
fo_pi_cnt = fopen('testvectors/matlab/pi_cnt.s32','wb');
fo_sin_term = fopen('testvec... |
clear;clc;
fileID = fopen('C:\Users\dushenda\Desktop\new.txt');
C = textscan(fileID,'%f %1s %f %1s %f %f %1s %f %1s %f %f');
fclose(fileID);
d=C{1};m=C{3};y=C{5};h=C{6};min=C{8};sec=C{10};
real=cast(C{11},'double');
[row,col]=size(d);
lon=ones(row,col)*94.01;lat=ones(row,col)*40.09;
pre=ones(row,col)*0.87;tem=o... |
clc;
clear;
close all;
m1=1;
m2=1.7;
%draw hexagon prism
%centroid-center of each plane;
%direct_vector-two direct vectors to decide plane.
%Vertex-Vertexes of prism
r=100;
Vertex(:,2)=[-r/2,-r/2,-r,-r,r/2,r/2,-r/2,-r/2,r/2,r/2,r,r];
Vertex(:,1)=[-sqrt(3)... |
function yn = separate_2d_filter(xn, fcol, frow, extmode, shift)
%--------------------------------------------------------------------------
% Making two dimenstion separable filtering of image.
% Syntax : yn = separate_2d_filter(xn, fcol, frow, extmode, shift)
%
% Input
% xn : 2-Dimension signal (im... |
function objective_evaluation(listfilename, outputfile, varargin)
% September 16th, 2013, By Reza FARRAHI MOGHADDAM, Synchromedia Lab, ETS, Montreal, Canada
% May 20th, 2009, By Reza Farrahi Moghaddam
%
% get the parameters
[u_tag, u_extention, back_shift_for_u, back_shift_for_GT, GT_tag_and_ext, SKL_GT_tag_and... |
% Example of using Rinocloud in a simulation
%Example simulation - This simulation has two randomly varied parameters
% Param1 and Param2 which impact the out put of the simulation result.
% A figure of merit (FOM) is calculated to determine how close the result
% is to the ideal - the lower the better. For a small F... |
%%%
%DPRO and IPRO in counter-PRO in RO-PRO
%{
%==============================================================
%Phi=0.2 counter IPRO vs. counter DPRO
clear;
load('0 0 (0.001) Phi02 Counter_PRO calculated in 06-Nov-2014.mat');
%y_0=opt(:,3);%.1:.02:max(opt(:,3));
%nsec_0=opt(:,5);%interp1(opt(:,3),opt(:,5),y_0,'picp')... |
function state = image_presentation(program, conf)
state = ptb.State();
state.Name = 'image_presentation';
state.Duration = conf.TIMINGS.time_in.image_presentation;
state.Entry = @(state) entry(state, program);
state.Exit = @(state) exit(state, program);
end
function entry(state, program)
data = sfix.util.data_thi... |
clear all; clc; close all;
%%
% x = ainit(3,3); % initialize audi variable, up to 3rd derivative covered
% y = func(x);
%%
p1 = 0.2; p2 = 0.5;
[x1, x2, x3] = ainit(1, 3, 0.5, 2);
x = [x1, x2, x3];
y = func(x, p1, p2);
h = ahess(y, 0);
|
function temperature = temperaturefcn(optimValues, options)
% From Equation 10 (Page 2326)
C = 2; % As per Section 4.1, Page 2327
temperature = C ./ log(optimValues.k * 100 + 1);
end
|
% Run sdtest for m = 10, 20, 40, 50 and Poisson matrix:
m = [10, 20, 40, 50];
for i=1:4
m(i)
K = sdtest(m(i), -1, 2, 1e-8, 10000)
end
|
function [y]=gridmake(imax,c)
% imax = 65;
% c = 1.5;
x = linspace(-1,1,imax);
y = 2*tan(c*x)/max(tan(c*x));
% dy = y(2:end) - y(1:end-1);
% figure(1)
% subplot(2,1,1), plot(x,y,'-*');
% subplot(2,1,2), plot(x(1:end-1),dy,'-*');
end |
function out = vect(vector,ndiff)
if nargin==1
ndiff = size(vector,1);
if numel(vector)==0
out = [];
return
end
end
for i=1:size(vector,2)
cont = 0;
for j=1:size(vector,1)/ndiff
out(j,i).value = vector(cont+1:cont+ndiff,i);
cont = cont+ndiff;
end
... |
function [pop_ini] = initialisation_real(indiv,dimension,exe)
% to prepare Matlab call to Python
% perform the initialisation in real mode
% make sure to put any initialisation after "clear classes"
% not really necessary unless there is a change in the function itself
%clear classes
char_pop = [... |
bits = [1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0];
i1=1;
t=0:0.001:length(bits);
for j=1:length(t)
if t(j)<=i1
y(j)=nn(t1);
else
y(j)=nn(t1);
i1=i1+1;
end
end
plot(t,y,'r-');
|
% Signature identification
% Author: X.GAO
% codes are original
clear;clc;
addpath(genpath('prtools'));
%% read files
sample_each_class = 24;
path = dir('data/*');
[image_list,writer_no] = read_files_iden(path,sample_each_class);
%% random choose training sets
sample_no = 24;
random_id = randi([1,sample_each_class... |
% usphst1.m : make a table for the integration start values for the ultra-spherical besselfunctions
% (phi_beta) for open universe : K = (omt - 1) * (h0 * h)^2 < 0 as a function of angle number l and wave number kb.
%
% a table x1 is made as function of la values (rows) and values for kk2/beta (columns)
% at phi_b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.