text
stringlengths
8
6.12M
function Trajectoire=polynome_traj(q_0, q_int, q_fin, dq_0, dq_fin,mc,dom_tra,T); Precision=mc*dom_tra; q0_1=[q_0(1:2);q_0(4:5);q_0(10)]; q_fin1=[q_fin(1:2);q_fin(4:5);q_fin(10)]; dq0_1=[dq_0(1:2);dq_0(4:5);dq_0(10)]; dq_fin1=[dq_fin(1:2);dq_fin(4:5);dq_fin(10)]; %calcul des coefficients 'a' du polynome qt1(t...
function [n,w,xi,N,dNdxi]=C3D4 %====================== ELEMENT INFORMATION ================================= % % n=number of integration points of the element % ncoord= numper of coordinates of the element (2D or 3D) % nodes=number of nodes of the element n = 1; ncoord=3; nodes=4; % %==...
function [output_img] = Bicubic(input_img, scale) % Get the input image size [row, col, depth] = size(input_img); % Calculate the output image size row_scale = round(row*scale); col_scale = round(col*scale); output_img = zeros(row_scale,col_scale,depth); % Extended fill img = zeros(...
close all; clear all; clc; init_theta=pi; init_theta_d=-12; %[a c w] motion_parameters=[-20 0.3 3]; simtime=10; sim motion_generator.slx %TODO %need path visulazation with configurations and alpha (a segment may be sufficient) figure(1) plot(mg_simout_theta.signals.values, mg_simout_theta_d.signals.values) ti...
%%DAY 1: TOTAL REFLUX DISTILLATION clear; clc; %% %Use polyfit to find a' b' and c' for all components global a1 a2 a3 b1 b2 b3 c1 c2 c3 %Use global variables so polyfit is used once T1 = [288.15 306.30 352.35]; V1 = [107.47 109.841 116.63]; p = polyfit(T1,V1,2); a1 = p(3); b1 = p(2); c1 = p(1); T2 = [273.15 323.1...
function [fibFeat stats] = processROI(IMG, imgName, tempFolder, keep, coords, distThresh, makeAssoc, makeMap, makeOver, makeFeat, sliceNum, infoLabel, tifBoundary, boundaryImg, fireDir, fibProcMeth, advancedOPT,numSections) % processImage.m - Process images for fiber analysis. 3 main options: % 1. Boundary analysis ...
%{ 2018-11-17 Quantify Px and Cd in Truss example Px: (Nfail x Narea x Nload) x Nmem matrix for (Load Dn) = [1 1;1 2;...;1 Narea;2 1;2 2;...;2 Narea;...;Nload 1;Nload 2;...;Nload Narea] Cd: Narea x Nmem matrix Cost matrix for decision alternatives Fmode: Nfail x 1 vector for Failure modes The order of e...
function [] = load_tao(name) s = sprintf('data\\cdf\\%s.cdf',char(name)); fprintf('\n Loading...'); ncload(s); clear('-regexp','QT_*','ST_*'); m1 = find(T_20 > 100); T_20(m1) = NaN; cd('C:\dc'); s1 = sprintf('data\\mat\\%s.mat', name); fprintf('\n Saving...'); save(s1) a = ...
folderprefix='C:\Users\Matthew\Documents\RbPapers\MBL_Critical_Behavior\data_repo\'; foldername={'W2_time_trace', ... 'W8.4_time_trace', ... 'W9.6_time_trace', ... 'W10.3_time_trace', ... 'W11.5_time_trace', ... 'W13.6_time_trace', ... 'W15.6_time_...
function [g_data] = load_geometry(object) %[g_data] = load_geometry(object) %Loads data for constructing 3D models of the surface of the object and %the stones inside it. %Parameter 'object' can have values 1 and 2. % %Returns a struct which has the following components: %x_ref, y_ref and z_ref are the coordina...
function [RMS_p,Max_p,RMS_pnorm,Max_pnorm] = spinaldata(Nx,Ny,pmax_data,prms_data,medium_img) Num_spine_pts = 0; RMS_p = 0; Max_p = 0; RMS_pnorm = 0; Max_pnorm = 0; %absolute_max_p = max(pmax_data(:)); %absolute_max_prms = max(prms_data(:)); absolute_max_p = 0; absolute_max_prms = 0; for i = 2:Nx-1 for j = 2:Ny-...
function [data] = create_synthetic_data(opt) % [data] = create_synthetic_data(opt) % Creates a random triplet of matrices or tensors, composed of a low-rank % component, a sparse component and their superposition. % INPUTS % opt a struct of options % OUTPUTS % data a struct containing the data ...
function gen_strf_graph(animal,pen,neuron) % animal = 'Ronnie'; % pen = 'P08'; % neuron = 11; dir_name = ['/home/alex/Desktop/Kernels/',animal,'/',pen,'/data/sep_kernel_adjbeta.mat']; save_dir = '/home/alex/Dropbox/SfN/'; coch_dir = '/mnt/40086D4C086D41D0/Reverb_data/coch.mat'; load(dir_name); load(coch_dir); %Generate...
function u = controller(params, t, X) % You have full state feedback available K = [-1.0000 -113.1949 -1.2465 -13.9340]; % After doing the steps in simLinearization, you should be able to substitute the linear controller u = -K*x u = -K*X; % Note from LeeChan: We see that the controller has nothing to ...
clear; clc; VSource = 1; nPoints = 100; tEst = 1; type = 'log'; instrreset; idOsc = 'USB0::0x0957::0x1725::MY49110441::0::INSTR'; idGen = 'USB0::0x0957::0x0407::MY44013172::0::INSTR'; [F, Mag, Phase] = autoBode(VSource, tEst, nPoints, type, idOsc, idGen); subplot(2,1,1); semilogx(F,Mag); subplot(2,1,2); semilogx(F,Phas...
function [subr,subr2,subr3]=en_sub3d3_dum(sub,sub2,sub3,n,delta0) %[cf_tem,abssb,sb]=coef_scan3d(sub,sub,n); %[cf_tem,abssb,sb2]=coef_scan3d(sub2,sub2,n); %[cf_tem,abssb,sb3]=coef_scan3d(sub3,sub3,n); len0=numel(sub); sb=zeros(1,len0); sb2=sb; sb3=sb; for ia=1:len0 sb(ia)=sub(n(1,ia),n(2,ia),n(3,ia)); sb2(ia)=...
clc % 清屏 clear all; %清除内存以便加快运算速度 close all; %关闭当前所有figure图像 SamNum=835; %输入样本数量为500 TestSamNum=835; %测试样本数量335 ForcastSamNum=835; %预测样本数量为1 HiddenUnitNum=7; %中间层隐节点数量取8,比工具箱程序多了1个 InDim=2; ...
hours_worked = [25 10 30 28 18]; hourly_rates = [25 26 27 28 29]; %five lines of code for five employees gross_pay(1) = hours_worked(1) * hourly_rates (1); gross_pay(2) = hours_worked(2) * hourly_rates (2); gross_pay(3) = hours_worked(3) * hourly_rates (3); gross_pay(4) = hours_worked(4) * hourly_rates (4); gross_pay(...
function varargout = hyper_rgb_comparison(varargin) % HYPER_RGB_COMPARISON MATLAB code for hyper_rgb_comparison.fig % HYPER_RGB_COMPARISON, by itself, creates a new HYPER_RGB_COMPARISON or raises the existing % singleton*. % % H = HYPER_RGB_COMPARISON returns the handle to a new HYPER_RGB_COMPARISON or t...
global global_rep; % MUST CHANGE ACCORDING TO SIMULATION! filtername = 'Sim_Param2'; filter = 0.99; xaxis = 'Host_Peer_Count'; % xaxis = 'Host_Wifi_Count'; % xaxis = 'Host_Wifi_Ratio'; % yaxis = 'DHT_Message_Count'; % yaxis = 'DHT_Message_Resent_Count'; yaxis = 'DHT_GetMessage_E2ELatency_Avg'; % yaxis = ...
% Add folders to path. addpath(pwd); cd algorithm/; addpath(genpath(pwd)); cd ..; cd utils/; addpath(genpath(pwd)); cd ..; cd solvers/; addpath(genpath(pwd)); cd ..; cd manopt; addpath(genpath(pwd)); cd ..; cd tools/; addpath(genpath(pwd)); cd ..; setenv('EDITOR', 'vim');
function [Xc, Yc,L]=centroid1(image) [r ,c ]=size(image); % calculate the centroid of image for i=1:r for j=1:c Xnum=Xnum+i* image(i,j); Xdeno=Xdeno+image(i,j); Ynum=Ynum+j*image(i,j); Ydeno=Ydeno+ image(i,j); end end ...
function [x, y] = ForwardEular(init, left, right, h) x = left:h:right; y = zeros(size(x)); y(1) = init; for i=1:length(x)-1 y(i+1) = y(i) + h*(y(i) - 2*x(i)/y(i)); end end
%% Opdracht 4 % Hieronder staat code waarmee je een grafiek van een inverse tangens % functie tekent. Maak een nieuw figuur aan. De variabele signaal bevat een % heleboel opvolgende waardes. Trek steeds de opvolgende waardes % van elkaar af (de tweede min de eerste) en stop het resultaat in een % vector genaamd 'diff...
clearvars; close all; clc; addpath(genpath('/home/hoa/ownCloud/Tracking/JoFR_2018')); load('JoFR_20180806170804_Stra_HorizonOne_3D_Yes_2Ray_Yes_High_Yes.mat'); est_Yes = MC_Results.est; RMSFound.Yes = cell2mat(cellfun(@(x) cell2mat(x.RMSFound),est_Yes,'UniformOutput',false)); FoundIndex.Yes = cell2mat(cellfun(@(x) x.k...
% for am4 nlat=180; nlon=288; nyears=30; conts=[-5,-4,-3,-2,-1,1,2,3,4,5]; caxisin=([-5 5]); % lcloud_ensmn is the raw data with seasonal cycle vartotrend=lcloud_ensmn; reg_trend lcloud_trend=regtrend_var_oo; % plot trend before seasonal cycle is removed cont_map_modis(lcloud_trend,vlat,vlon,conts,caxisin) colorbar ...
function xyzMicrons = viking2micron(xyz, source) % VIKING2MICRON Scales xyz coordinates to microns % Inputs: % xyz coordinates [N x 3] or xy [N x 2] % source volume name/abbreviation % Output: % xyzMicrons coordinates converted to microns % % History: % 3Nov2017 - SSP % 26Jun2019 - SSP - Adde...
function [ res ] = compositionFinder( mass, numC, isoDist ) %compositionFinder This function accepts an accurate mass and an %estimation of the number of carbons that is ultimately derived from the %isotope cluster. The procedure starts with the core elements (CHNOPS) and %then expands to others, such as Cl,Br,I,Se,Na...
function [nu Lambda cholLambda mu ] = initVariationalGaussNatural( D, paramPost ) %INITVARIATIONALGAUSSNATURAL Initializes variational approach with Gaussian posterior % Natural parameterization % ParamPost: cell (possibly empty) with natural parameters % D: Dimenisonality of Gaussian if (isempty(paramPost)) nu ...
function Y=myReshape(X,st) if st==0 [M,N]=size(X); Y=zeros(M*N,3); for i=1:M for j=1:N k=M*(i-1) + j; Y(k,1)=i; Y(k,2)=j; Y(k,3)=X(i,j); end end else M=max(X(:,1)); N=max(X(:,2)); Y=zeros(M,N); for i=1:M ...
function out = makeplot(t, dt, ny, nx, nt, x, y, u) uplot = reshape(u, [ny, nx, nt]); num_contours = 50; figure; contour(x, y, uplot(:,:,t), num_contours); colorbar; title(sprintf('Pollution at t=%f', (t - 1)*dt)); xlabel('x'); ylabel('y'); out = 1; end
function [NTNi] = QUAD2D_NTN_INT(V) %QUAD2D_NTN_INT Returns the integral of the outer product of the %shape functions vector against each other for a 2D quad defined by %given node coordinates % USAGE: % [NTNi] = QUAD2D_NTN_INT(V); % INPUTS: % V : 4x2 ordered coordinates of vertices (global CS) % OUTPUTS: % NTNi :...
%{ learningClassImage.m %} imgRbg2Gray('01.jpg');% 将彩色图片进行阈值化处理 waitBar(10e+2);% 延时 200 ms figure; imgGraythresh('./ImageProcessing/Result/result01.png');% 将阈值化处理后的图片进行二值化分割
function [oral, pharyngeal,total,smooth_total]=matrix(vocaltractnumber,vowelnumber) oral=zeros(7,11) oral(vocaltractnumber,vowelnumber)= pharyngeal=zeros(7,11) total=zeros(7,11) smooth_total=zeros(7,11) % oral_norm=zeros(8,12) % pharyngeal_norm=zeros(8,12)
function [structData] = computeCOP(structData) % Calculates the COP and Free moment from force and moment data % % Written by Thor Besier, James Dunne, Cyril (Jon) Donnelly, 2008 % Last Modified; James Dunne, September (2014). for i = 1 : length(structData.fp_data.GRF_data) % Place these dat...
clear all;close all; bigN = 36; N = 4; N_list = 4:2:bigN; alpha_list = [1;0.1;0.01]; scaling = [1;0.75;0.5;0.25;0]; colors = {'b','r'}; whichN = [4,18]; count = 1; for l = 1:length(whichN) N = whichN(l); N_ind = find(N_list == N); for j = 1:length(alpha_list) alpha = alpha_list(j); ...
% 6、编写程序提取RGB彩色图像中感兴趣的颜色的区域。 I = imread('yellowlily.jpg'); [h,w,d]=size(I); for i=1:h for j=1:w if I(i,j,1)>128&&I(i,j,2)>128 % I(i,j,3)=0; else I(i,j,1)=0; I(i,j,2)=0; I(i,j,3)=0; end end end imshow(I) % X = I(1:100,20...
function [state, reward] = pickup( state ) %PICKUP Summary of this function goes here % Detailed explanation goes here taxiloc=state(1); passloc=state(2); reward=-1; if passloc<5 && getdroplocation(passloc)==taxiloc, state(2)=5; reward=1; end end
% CometPosition: Make observations of the Comet position at % certain times and with a certain noise level. % function [PositionData] = CometObservation(Time ,NoiseLevel) if nargin < 2 NoiseLevel = 1e-3; end % Default Noiselevel % Create a set of observation of the Comet position at certain times. % At time t=0 ...
function [dfG,dfR]=takeDelta(CinGreen,CinRed,FrameRate) %normally start at 2 but try moving to 10 because sometimes it messes up %the normalization I think? baseG=mean(CinGreen(:,2:5*FrameRate),2);%skip the first frame since it's sometimes messed up dfG=CinGreen./baseG; baseR=mean(CinRed(:,2:5*FrameRate),2);% same ski...
function image = removeGcleff(im) thickim = bwmorph(im,'thicken'); h = sum(thickim,1); [rows, columns] = size(im); thresh = 100; h = h > thresh; [vpks, Gcleffloc] = findpeaks(double(h)); image = im(:,Gcleffloc(1)+25:columns); end
function p = periodic(t, n) a_n = integral(@(x) (f(x) .* cos(n .* x .* 2 .* pi ./ t)), 0, t) * 2 / t; b_n = integral(@(x) (f(x) .* sin(n .* x .* 2 .* pi ./ t)), 0, t) * 2 / t; p = pi * power(power(a_n, 2) + power(b_n, 2), 0.5);
hold on clc; clear; % close all; %% Load Data load MYdata_calib_ds1a.txt; Inputs=MYdata_calib_ds1a(:,1:10); Targets=MYdata_calib_ds1a(:,11); nSample=size(Inputs,1); S=randperm(nSample); Inputs=Inputs(S,:); Targets=Targets(S,:); pTrain=1; nTrain=round(pTrain*nSample); TrainInputs=Inputs(1:nTrain,:); Tra...
% ==================================================== % % % une routine pour la mise en oeuvre des EF P1 Lagrange % pour l'equation de Laplace suivante, avec conditions de % Neumann sur le maillage nom_maillage.msh %c % | -Delta u + u= f, dans \Omega % | du/dn = 0, sur le bord % % ========================...
function update_STUFF_M400(inputFile, goodFrac, ranking) % $Rev: 1115 $ % $Author: mrakitin $ % $Date: 2015-08-18 01:44:25 +0400 (Tue, 18 Aug 2015) $ global ORG_STRUC global POP_STRUC global USPEX_STRUC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%% Some parameters can be updated from INPU...
%% clear old stuff, load data clear; clc; close all; aircraft %% Find centralised solution [AL1, BL1, AT1, BT1] = findLargeSystem(A1, B1, Tfinal); [AL2, BL2, AT2, BT2] = findLargeSystem(A2, B2, Tfinal); [AL3, BL3, AT3, BT3] = findLargeSystem(A3, B3, Tfinal); [AL4, BL4, AT4, BT4] = findLargeSystem(A4, B4, Tfinal); [H...
%% Histograms for the features and classes % Constants bins = 10; y = [0 30]; x = [0 8]; fontsz_legend = 12; fontsz_title = 14; %% Iris Setosa figure(3); subplot(3,1,1); hold on; histogram(x1(:, 1), bins); histogram(x1(:, 2), bins); ylim(y); xlim(x); grid on; title('Data Iris Setosa', 'fontsize', fontsz_title); leg...
function r=sig_fit(varargin) %% Fit relaxation signals. % % sig_trace <file> -- process signal list, write results to file.fit and file.fit_img % sig_trace <date> <file> -- proces one signal % sig_trace -- process last signal % sig_trace <date> <file> <par> ... -- use parameters (t1fit,t2fit,exp) % ...
%%% Compare the maxima againt the EC curves obtained from the LKCs FWHM_vec = 2:6; nsubj_vec = [10,20,25,50,75]; global RFTboxloc maxdistloc = [RFTboxloc, 'NeuroPaperCode/Maxdist/']; for I = 1:length(FWHM_vec) FWHM = FWHM_vec(I); for J = 1:length(nsubj_vec) nsubj = nsubj_vec(I); load([m...
function [mag_e, a, theta, Omega, i, omega] = orbit_elements(r2, v2, u) %Magnitude of position and velocity mag_r2 = norm(r2); mag_v2 = norm(v2); %Momentum h = cross(r2, v2); mag_h = norm(h); %Eccentricity e = (cross(v2, h) / u) - (r2 / mag_r2); mag_e = norm(e); %Perifocal cal...
function LL = logLikelihoodQBOLD(XX) % Calculate the log likelihood that a looked-up set of data has a given value of % OEF and DBV. For use with FMINSEARCH (or similar) script only. Requires % qASE_model.m. Derived from DBV_loglikelihood.m % % MT Cherukara % 2018-11-02 % declare global variables global S_true param1 ...
%name: Zhimingyuan Liu %description: %this assignment reads four sound files and using ASDR, ADDITION, AND TIME %SCALE TO MAKE THE SOUND EFFECT clear all; close all; % READ THE FOUR SOUND FILES [y1, Fs1] = audioread('water.wav'); [y2, Fs2] = audioread('scream.wav'); [y3, Fs3] = audioread('saw.wav'); [y4, Fs4] = audio...
datadir='/nfs/to-eeg/'; subno=1; addpath('/nfs/to-eeg/code/functions/') for n=1:length(EEG.epoch) Event_Order{n} = EEG.epoch(n).eventtype{1}; end item_hit=strsearch('200',Event_Order); order_hit=strsearch('220',Event_Order); EEG=pop_select(EEG, 'nochannel', {'CB1' 'CB2' 'HEO' 'VEO'}); electrode_locations = cell...
clear all close all % the Control point weighting scheme , % seen in paper<Non-rigid Registration Using Free-form Deformations> by Loren Arthur Schwarz % with the test of the red point in figure 5.2 [e,f,g,h]=dB(1); [a,b,c,d]=BB(0); w=[e,f,g,h]; m=[a,b,c,d]; for i=1:length(w) for j=1:length(m) q(j,i)=w(i)*m(j...
% Plots oblate spheroid coordinate surfaces clear; %close all; e = .9; % Shape a = 3.75; % Semimajor axis length, units lambda = pi*75/180; % Azimuth range eta = 0.7; % El...
% su_write_2d_model : Write model for SU modeling function su_write_model(v,filename); if nargin==0 help su_write_model end if nargin<2 filename='velocity.out'; end write_bin(filename,v(:));
function RunSystemCommand(GEMpath, DATpath, outDir) commandLine = strcat(InsertQuotes(GEMpath), 32, '-log', 32, '-f', 32, InsertQuotes(DATpath), 32, '-wd', 32, InsertQuotes(outDir)); system(commandLine); end function quotedText = InsertQuotes(text) quotedText = strcat('"', text, '"'); end
function spinMutation(Ind_No) % USPEX Version 7.4.1 global POP_STRUC global ORG_STRUC global OFF_STRUC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%% CREATING Mutants by atom positions mutation%%%%%%%%...
function [] = print_pattern_stat(all_patterns) %PRINT_PATTERN_STAT Print some info about the patterns fprintf('Total patterns: %d\nPixels 1: %.2f%%\nPixels -1: %.2f%%\n', ... size(all_patterns, 1), ... 100*sum(all_patterns(:) == 1 )/numel(all_patterns), ... 100*sum(all_patterns(:) == -1)/nu...
function x = creatingInputBitSequence(length) x = randi(2, [1 length]) - 1; end
function result=Kapur_Entropy(LP,TH) %function result=Kapur_Entropy(LP,TH) %calculate the maximum entropy based on the input thresholds %input: %LP:normalized histogram %TH:thresholds %output: %result:the entropy clear k i j k=size(TH,2); result=0; s_th=[0 TH length(LP)]; s=sort(s_th...
function [ mask ] = thecannon_set_mask( wave, mask0, region_set, value_set ) % Written by: Bo Zhang (NAOC, bozhang@nao.cas.cn) % Last modified: 24-Jun-2016 % % Aim: % - convenient tool for setting a mask % Example: % - [ mask ] = thecannon_set_mask( wave, 0, region_set, 1 ); % - % INPUT: % - wave: wave ...
%% clear all close all dr = '/Users/mertozkan/Documents/MATLAB/DD/DDPOPO/data/MOz'; %function analys_ddpopo(dr) op = concatenate_files(dr); rxn_t = str2num(char(op(:,6))); trl = label_trials(op(:,3), op(:,2), rxn_t); [isOk, acc] = accuracies(op,trl); rt = reaction_times(trl, rxn_t, isOk); % end %% function rt = ...
clear;clc %This script plots examples of functions that are not everywhere concave %but still have negative Jensen gaps %Define functions f1 = @(x) 1./(1+exp(-5*x + 2.1)) - 1/(1 + exp(2.1)); f2 = @(x) 0.02*sin(100*x) + x./(0.3 + x); %Simulate to estimate Jensen gaps a = 0; b = 1; x = linspace(0,1,1000); mu = (a+b)...
clear eng.engLoad0 = 1; EngineSystemParameters7X82; mdl = 'TurbochargerFullMap'; open_system(mdl); for ii = 1:11; eng.engLoad0 = eng_data.TC.Pe(ii)/eng_data.TC.Pe(2); EngineSystemParameters7X82; complete = 0; k = 0; while (complete == 0); k = k + 1; if k > 10 break; ...
%第二章46页 clear num=20;%采样点个数 theta=linspace(-3*pi,3*pi,num); x=cos(theta); y=sin(theta); z=theta/2; plot3(x,y,z,'.-','markersize',20); Pname=['fig2_7-',num2str(num),'.mat']; pathname='C:\CodeStore\matlab\几何迭代法\data\'; save([pathname,Pname],'x','y','z')
function [C, sigma] = dataset3Params(X, y, Xval, yval) %EX6PARAMS returns your choice of C and sigma for Part 3 of the exercise %where you select the optimal (C, sigma) learning parameters to use for SVM %with RBF kernel % [C, sigma] = EX6PARAMS(X, y, Xval, yval) returns your choice of C and % sigma. You should co...
function [ Y, C, W, beta, obj] = opmc( X, k) %OBJ \min \sum_{v=1}^V ( \|\mathbf{X}_v - %\mathbf{Y}\mathbf{C}_v\mathbf{W}_v\|_F^2 % s.t. W_vW_v^T = I V = length(X); n = size(X{1}, 1); c = k; % init Y = randi([1,k],n,1); for v=1:V C{v} = rand(k,c); W{v} = rand(c,size(X{v},2)); end beta = ones(V,1)./V; t = 1; w...
function [ outStruct ] = clustered_lat_feat_loocv( As, targs, d, kCluster ) %clustered_lat_feat_loocv Classify graphs using bayes plugin based on %clustered estimated latent features. % Estimate latent features using eig method. Cluster the targs==0 and % targs==1 groups of features into kCluster clusters giving 2 ...
function vol = getCylinderVolume(bbox, allowance) %detects the most similar dimensions %and assumes it as end face r12 = abs(1 - bbox(1)/bbox(2)); r13 = abs(1 - bbox(1)/bbox(3)); r23 = abs(1 - bbox(2)/bbox(3)); if (r12 < r13) && (r12 < r23) z = bbox(3); ...
[soundIn, freqSamp] = audioread("C:\Users\dzecc\Desktop\wave.wav") soundOut = zeros(length(soundIn),2); soundOut(:,2)=soundIn; for n = 2:length(soundOut) soundOut(n,1) = soundOut(n-1,1) +1/freqSamp; end soundOut = zeros(length(soundIn),2); soundOut(:,1) = soundIn(:,1); soundOut(:,2) = soundIn(:,1); soundOu...
% ONLY for MNIST dataset (for rebuttal): % plot scatters of ID vs replication, % for threshold = 7000, 8000, 9000, 10000. % This is for rebuttal. % NOTE: not plot fitted curves yet --> since MNIST has trend different from % other datasets! % referenced from plt_IDvsRep_forSuppMat.m %% parameters: % an array of all ...
function [J, grad] = cofiCostFunc(params, Y, R, num_users, num_movies, ... num_features, lambda) X = reshape(params(1:num_movies*num_features), num_movies, num_features); Theta = reshape(params(num_movies*num_features+1:end), ... num_users, num_features); J = 0; X_gr...
function output = piece_feature2(data, label) num = size(data,2); data_len = 20; jump = 5; data_size = floor((num-data_len)/jump); m = 1; n = data_len; result = []; for j = 1:data_size period = data(m:n); result = [result;feature_table(period,label)]; m = m + jump...
function [p] = norm2(x) %NORM2 [p] = norm2(x) p = norm(vec(x), 2); end
function [aux_ini_fil,filaments] = move_index_2D(S_new,filaments,P) aux_ini_fil = zeros(size(P.ini_fil)); % update the membrane vertix closer to the line traced between the % nucleation location and the membrane for l = 1:length(P.ini_fil) if P.line(l,4) == 1 ind = find(S_new(P.index,1)...
function y = mylpc(x,p) rx = xcorr(x); rx_toeplitz = rx(length(x):length(x)+p-1); rx = rx(length(x)+1:length(x)+p); Ra = toeplitz(rx_toeplitz); a = (Ra\rx)'; y = [1 -a]; end
%% 4week HW Uniform & Non-uniform Quantization % Copyright 2018, Jungwon Choi, INHA Electronics close all; clear; img = imread('fig2.jpg'); % 원하는 이미지를 불러오기 img = rgb2gray(img); % 이미지를 흑백으로 변환 img = double(img); % 연산을 위해 픽셀 값을 실수형으로 변환 [H, W] = size(img); % 이미지의 크기 추출 N = 7; ...
% Generate circular white gaussian noise of zero-mean unit-variance numRealisations=100;N=1000; x = wgn(N,numRealisations,0,'complex'); [circ_quot_x , circ_coeff_x] = circularity_calculation(x); % initial Complex Distribution of x: figure(1); plot(x,'b.','LineWidth',2);xlabel('Real');ylabel('Imaginary');title('Circul...
h = rcosdesign(0.25,6,4);
function popupmenues(handles) global wd x y ll hll parlist xselect yselect pplot pplot = 0; resetall(handles) set(handles.checkboxrefine,'Value',0,'Enable','off') set(handles.resetrefinebutton,'Enable','off') set(handles.realtimecheckbox,'Value',0,'Enable','off') xstrings = get(handles.popupmenu1,'string'); ystrings = ...
clc; clear; close all; %Edge Detection %% Inporting an Image Image = imread('abc.jpg'); Image = imresize(Image, 0.5); Image = rgb2gray(Image); figure(1); imshow(Image); %% Edges by using DWT2 [cA, cH, cV, cD] = dwt2(Image,'haar'); figure(2); subplot(2,2,1); imshow(uint8(cA)); subplot(2,2,2); imshow(uint8(cH...
function Electrifield (W) c = 3e+8; x = 0 : .001 : 10 ; t = 0 : .001 : 10 ; B = W/c; Bx = B * x; Wt = W * t; [BX,WT] = meshgrid(Bx,Wt); E = cos(WT - BX); %mesh(E); surf(BX,WT,E); %axis square; xlabel('X'); ylabel('t'); zlabel('E'); grid on end
function [row, col] = mapLocation(Loc) % function to translate a location number (1-864) into the coordinates % where that location appears in the drug ID table. This was designed for % use with a 96 well plate with 9 locations in each well. Should the % experiment be redesigned in some significant way, this funct...
clc;clear all addpath(genpath(pwd)) addpath(genpath('..\ADAPT_R&D_0.0\')) % define model specifics m.modelname = 'M2'; m.Niter = 100; %number of data samples m.Ndt = 200; %number of time samples m.info.smooth = 1; %default: 1 m.info.sd_weight = 1; %default: 1 m.info.lambda_r ...
function [average, eigenvectors, eigenvalues] = compute_pca(vectors) % function [average, eigenvectors, eigenvalues] = compute_pca(vectors) number = size(vectors, 2); % note that we are transposing twice average = [mean(vectors')]'; centered_vectors = zeros(size(vectors)); for index = 1:number centere...
% x/a value range function [range] = FractionValueRange(lx,rx,la,ra) options = [lx/la, lx/ra, rx/la, rx/ra]; range = max(options) - min(options); end
x=.1:.1:10; y=log10(x); plot(x,y,'b') title('log10(n)'); xlabel('x'); ylabel('y')
%% evaluation of the 2d plane with 2d forward kinematics problem solution % forward kinematics for original configuration % robot definition % robot configurations ROBOT = '2d2linkBot'; theta1 = pi/3; theta2 = pi/6; ys_ori = [theta1; theta2]; % forward kinematics xpos = cos(theta1) + cos(theta2); ypos = sin(theta...
%% Check that we can find the dataset opto_data_file = fullfile(files_path, 'preprocessed_data', 'ofc_learning_choosing_dataset_opto.mat'); assert(exist(opto_data_file, 'file') == 2, ... 'Unable to find opto dataset. Please find "ofc_learning_choosing_dataset_opto.mat", and place it in the Matlab path.') %% Load ...
%% specify filename filename = 'kkt_mat_0.iajaaa'; f = fopen(filename,'r'); A = fscanf(f, '%f'); fclose(f); %% data loading m=A(1); % matrix size nnz=A(2); % number of nnz of the upper triangle rowp = A(3:m+3); % row pointers in colidx and vals (see below) colidx=A(m+4:nnz+m+3); % column indexes for each nz vals=A(nn...
%15-79 mA = input("Mass of disk A in kg : "); mB = input("Mass of disk B in kg : "); vA = input("Velocity of disk A in m/s : "); vB = input("Velocity of disk B in m/s : "); angle = input("angle of disk B: "); vBx = vB * cosd(angle); vBy = vB * sind(angle); e = input("Coefficient of Restitution : "); %conservation of ...
function [] = jess_run_gui() %RUN_JESS opens a GUI window with buttons to run and pause the rules engine % j is the jess.Rete object persistent control_window %% if isempty(control_window) j = global_jess_engine(); run_button = javax.swing.JButton('Run'); listener = j.eval([... ...
function [theory_y0y0,theory_y1y1] = func_yi(p,n0,n1,z,alpha0,beta0,alpha1,beta1,c,c0,c1,g0_,g1_,g0,g1,Sigma0,Sigma1,Sigma0_tilde_1,Sigma1_tilde_1,Sigma0_tilde,Sigma1_tilde,H0_bar,H1_bar,mu) %% i = 0, compute asmyptotic equivalence of H1*Sigma0*H1 C = [c0,c1]; g_=[g0_,g1_]; Sigma_tilde_ = cell(2,1);Sigma_tilde_{1,1} =...
%% figure 4a and b %b delta = [6.5 9 11 12 15 14 13 11 9.5]; lw = [0 .13 .16 .29 .4 .55 .66 1.02 1.17]; figure(10); hold on; plot(lw,delta,'k.','MarkerSize',25,'MarkerEdgeColor','k'); xlabel('l/w'); ylabel('\Delta'); axis([0 1.3 0 18]) figure(12) hold on; plot(lw,exp(delta),'k.-','MarkerSize',25,'MarkerEdgeColor','k');...
clc; clearvars; close all; SigmaAmplitudes = 0:0.5:2; load(['../Obtain Component-Based Alignment Results/ResultsComponent.mat']); NoiseLevels = 0:0.1:0.5; ScoresAcrossAmplitudes = WidthAmplitudeScores{1,1}; Figure1 = figure(1); set(Figure1, 'Position', [100, 100, 550, 350]); plot(SigmaAmplitudes, ScoresAcrossAmplit...
function params=subParameters(comm_params, sub_strains) totStrains=length(comm_params.Vs)/2; numStrains=length(sub_strains); params.seg_rate=comm_params.seg_rate; params.conj_rate=comm_params.conj_rate; params.S0=comm_params.S0; params.T=comm_params.T; params.d=comm_params.d; param...
function [Overlapmax,extradetected,notdetected] = IoUvalues(data,b2,i) box1=data.Var2(i); box1=cell2mat(box1); box2=b2; n2=size(box2,1); n1=size(box1,1); %Calculation of all the IoU for each actual gate for each prediction for j=1:n1 for k=1:n2 first=box1(j,:); second=box2(k,:); Overlap(j,k...
function [moo,m1oSum,n_pq] = cent_moment(p,q,A) [m n]=size(A); moo=sum(sum(A)); m1o=zeros(m*n,1); mo1=zeros(m*n,1); cnt1 = 1; cnt2 =1; for x=1:m for y=1:n m1o(cnt1,1)=(double(x)*double(A(x,y))); mo1(cnt2,1)=(double(y)*double(A(x,y))); cnt1 = cnt1+1; cnt2 = cnt2+1; end end m1oS...
clear svgname='巴彦淖尔市'; qudianjiange=1; %取点模式 0均匀取点 1非均匀取点 switch qudianjiange case 0 pointnum=250; %总取点数目 R = loadsvg([svgname,'.svg'], 0.001,0 ); P=R{1,1}; P=[P;P(1,:)]; % P=unique(R{1,1},'row','stable'); csl = [0;cumsum(vecnorm(diff(P),2,2))]; %累加长度 ...