text
stringlengths
8
6.12M
function [Output,t_array,Theta_array] = myRadonTrans(Input_Image, Delta_s) t_array = [-90:5:90]'; Theta_array = [0:5:175]'; Size_Theta = size(Theta_array); Size_t = size(t_array); Output = zeros(Size_t(1), Size_Theta(1)); for i=1:Size_Theta(1) for j=1:Size_t(1) ...
x=-32:0.1:32; y=zeros(length(x)); for i=1:length(x) y(i) = -((0.25)^4)*x(i)*x(i) + 4; end plot(x,y); ylim([0 10]); set(gca,'XTick',-32:32:32); set(gca,'XTickLabel',{'-X','0','X'}) set(gca,'YTick',0); set(gca,'YTickLabel',{'0'});
clc clear all close all load('D1(n4k4)') d = size(D1, 1); B = gaussian(0.1, 0.3, d, 1000, 1); m = 4:1:100; mn = length(m); n = size(D1, 2); k = 4; tol = 10^-5; y0 = B(:, 250); %% for j = 1:mn err=0; for i=1:1000 [phi, locations] = delete_rows(d, m(j)); y = phi * y0; ...
% Volumetric flow [m^3/s] Q_c(i) = cool.m / rho_c(cool.t(i)); % Flow's velocity [m/s] w_c = Q_c(i) / cool.A; % Auxiliary variables a = s1 / d2; b = s2 / d2; if b < 1 psi = 1 - pi / (4 * a * b); else psi = 1 - pi / (4 * a); end % Arrangement factor fA = 1 + 2 / (3 * b); clear a b % Reynold number Re_c = w_c...
function Logical = IsValidString(String,Length) error(nargchk(1,2,nargin)); if (ischar(String) || iscellstr(String)) Logical = 1; else Logical = 0; end if (nargin > 1) if (length(String) > Length) Logical = 0; end end end
% $Header: svn://.../trunk/AMIGO2R2016/Preprocessor/AMIGO_gen_C_jacobian.m 2057 2015-08-24 13:06:14Z attila $ function AMIGO_gen_C_jacobian(inputs,fid) % generate the Jacobian of the system for CVODES fprintf(fid,'\n/* Jacobian of the system (dfdx)*/\n'); % fprintf(fid,'int amigoJAC(long int N, realtype t, N_Vector y,...
function [w] = createWindow(M) % M is L(msec)*Fs(Hz) %we will create a symmetric window with length 2M windowLength = M*2; w = zeros(windowLength,1); for i=0:windowLength if(i>=1 && i<=M/2) w(i)=0.54-0.46*cos((2*pi*i)/M-1); elseif(i>=M/2+1 && i<=(3*M/2)) w(i)=1; elseif(i>=(3*M/2)+1 && i<=2*...
% Testing whether the quality improves if the filter is iterated function denoise_demoGuidedFilter_iterations() %% Import test data load(fullfile('..', 'debugMATs', 'testSlices.mat')) % z-slices of 9-11 from first time point of: % "CP-20150323-TR70-mouse2-1-son.oib" from Charissa ...
function [ lst_out, eot_correction ] = get_ace_lst( tanstruct_in, do_EOT ) %A function to calculate the local solar time (LST) of ace measurements %using the ace measurement times and the longitudes. %Longitude information can be added to an ace structure using %'merge_ace_glc.m'. % *INPUT* % tanstruct_in: S...
function filter = isConstant(fieldArr) filter = zeros(1, length(fieldArr)); for i = 1:length(fieldArr) field = fieldArr(i); filter(i) = length(field.src.time); end filter = filter < 2;
function agents = InitializeAgents( areaSize, susceptibles, infected, recovered) agents = zeros(areaSize, areaSize, 3); susceptiblePositions = randi(areaSize, susceptibles,2); agents(:,:,1) = GenerateLattice(susceptiblePositions, areaSize); infectedPositions = randi(areaSize, infected,2); agents(:,:,2) = G...
%% --------------------------- Missile Parameters ------------------------- % clc; clear all; close all; set(0,'defaultfigurecolor',[1 1 1]); global tF rho_v rho_w M_d T_m Vc tau N K K_dth dt tout resolution %% % load('traj_unsat'); % ------------------- Initialize Simulation ------------------- % MP = 1; NMP = -...
function [mu_in, sigma_in, mu_out, sigma_out] = meanshift_method( data,sigma, width, w_s_1, w_s_2, thrd ) %SCRIBBLE Summary of this function goes here % Detailed explanation goes here I_obj = []; I_bck = []; % for im = 1:round(numel(data)/4) %zebrafish % for im = 26:26 %pig for im = 1:1 %bunny I = d...
function [f, df, d2f] = objFunQuad( x, Q, b, c ) %OBJFUNQUAD evaluate objective function, gradient, and hessian %for quadratic problem % % inputs: % x current iterate % Q n x n matrix % b vector (linear part) % c constant vector % % outputs: % f objective value % ...
function print_vector(label, vector, spacing) ret = []; for i = 1:spacing ret = [ret, '...']; end ret = [ret, label, ': | ']; for i = 1:length(vector) ret = [ret, num2str(vector(i)), ' | ']; end disp(ret); end
%绘制船体优化后 function wLine = dispBoat(theta,z0) [A, B, H] = setValue(); xc = 0; yc = 0; zc = H; xr = sqrt(H/A); yr = sqrt(H/B); zr = H; xUp = xr*0.5; yUp = yr*0.5; zUp = zr*0.5; hold on; xlabel('x'); ylabel('y'); zlabel('z'); [X, Y, Z] = ellipsoid(xc,yc,zc,xr,yr,zr,100); Size = size(X); colSize = Size(1); z1 = Z; z1(ceil(...
function CC_delete_missmatch data = importdata('../doc/CC_bipolar_label_counts.log',','); strs = cellfun(@(x) regexp(x,'_','split'),data.textdata(:,1),'uni',0); strs(1) = []; subs = cellfun(@(x) x{1},strs,'uni',0); runs = cellfun(@(x) x{2},strs,'uni',0); runs = str2double(runs); diffmask = diff(data.data,[],2) ~= 0; b...
function relations = MakeRandomRelations2( h ) relations=cell(2,h); for i=1:length(relations) relations{1,i}=i; curRelNum=round(rand*5+0); % relations{2,i}=i; % relations{3,i}=i; if (curRelNum==0) curRel='EXN'; relations{2,i}=curRel; relations{2,i+1}=curRel; ...
function p=orient_stats(bins,orientations) fi=find(bins.light>80); bi=find(bins.light<100); idx=intersect(fi,bi);%get the right bins p_odour=sum(orientations.odour(:,idx),2); p_light=sum(orientations.light(:,idx),2); p_odour2=sum(orientations.odour2(:,idx),2); p_light2=sum(orientations.light2(:,idx),2); %use the p...
classdef HyperParam < Tensor methods function addgrad(obj, grad) obj.gradient.push(grad); end function update(obj) if isempty(obj.prior) grad = obj.gradient.pop(); grad = obj.stepsize(grad) * grad; else ...
%% Function description % The function solves a system of equations for % diagonally dominant matrix A using the Jacobi iteration method % Inputs: A (diagonally dominant matrix) % b (a vector) % tol (specifies the tolerance of accuracy) %% Function code function [x, iteration_count] = jacobi(A, b, tol...
function [IB,tB,icB]=Bursts2Spikes(BP,BI,icA) %[IB,tB,icB]=Bursts2Spikes(BP,BI,icA); % Function purpose : Coverts burst timing (Burst peak) and intensity (burst intensity) cell arrays to index channel representation % % Function recives : BI [ms]- cell array of the number of clusters length with the total activty in...
% 7/26/13 % intergrateMode1.m % nested function to intergrate quadrotor with cable-suspended load % no controller % 1D case % Dependancies: desiredTraj.m % % inputs: % tspan: 1x2 vector, [timeBegin timeEnd] % x10: 1xn vector, initial conditions % g, mL, mQ, JQ, l: real numbers, constants % kpx, kdx, kpL, kdL, ...
function [x,kount] = orbit6(z) phi=inline('z.^2 -1.25'); fxpt1 = -0.724745; fxpt2 = 1.72474; zk = z; iflag1 = 0; iflag2 = 0; kount = 0; while kount < 100 && abs(zk)<= 100 && iflag1<5 && iflag2< 5 kount =kount +1; zk=phi(zk); err1=abs(zk-fxpt1); if err1 < 10^(-6), iflag1=iflag1+1; else,iflag1=0...
function [rbox] = hamg4_to_box(rham); % function [rbox] = hamg4_to_box(rham); % WARNING! do not use % % Convert Hamming apodized radiance to crude approximate % boxcar/unapodized radiance by a linear combination of radiances. % This version requires 4 guard channels at each end of the band(s). % % Input: % rham - [...
function [centricEllipticalMask] = centricDisk(maskSize,radius) % % % TODO: make it for n dimensional if isscalar(maskSize) if isscalar(radius) %create circle in square mask radius= [radius, radius]; maskSize = [maskSize, maskSize]; else maskSize = repmat(maskSize,1,length(rad...
function [Wx, Wy] = trainCCA(Cxx, Cyy, Cxy, dCCA) % % Input % Cxx : covariance matrxi of X-X % Cyy : covariance matrxi of Y-Y % Cxy : covariance matrxi of X-Y % dCCA : # of CCA dimensions % Output: % Wx : projection matrix of X % Wy : projection matrix of Y % % [Ndimx Ndimy] = size(Cxy); % eta = S3PLHpa...
function NewSamples = samplesChunked(Samples,Nrep,SampleSize); % Waveform/samples - chunks the samples from waveform object to make it work with Nrep % % [Y] = samplesChunked(W) gets a fully expanded and breaks it into % chunks. These chunks can be used with Nrep. % % Created by Gowtham 21/08/20 % (L...
% Daniel Fortunato (81498), Teodoro Dias (81723), Pedro Santos (84162) function [J, dejp, dejr] = jacobianDetermination(i, j, w) syms th0 th1 th2 th3 th4 th5 a1=0; a2=0; a3=40; a4=-120; a5=0; a6=0; a7=20; a8=0; a9=0; a10=0; alpha1=0; alpha2=0; alpha3=-sym(pi)/2; alpha4=0; alpha5=0; alpha6=-sym(pi)/2; alpha7=...
% STFT -- Short-Time-Fourier-Tranformation % spectrogram, matlab built-in function close all,clc N = 1024; n = 0:1:N-1; w0 = 2*pi/5; x = sin(w0*n)+10*sin(2*w0*n); subplot(2,1,1) plot(x) subplot(2,1,2) S = spectrogram(x,10,5); spectrogram(x, 'yaxis')
plotType=1; %1 for constant angle 2 for constant l/w switch plotType case 1 %l/w dv='lw'; dvunits = ''; dvlabel = 'l/w'; dvaxis =[0,1.4,0.05,0.40] case 2 %angle dv='ang'; dvunits = '\circ'; dvlabel = 'Angle (\circ)'; dvaxis =[0,120,0.05,.45] ...
function yprime = syst_odes_wSocCoupling(t, x_vec, parameters_, temp_history, x0) global data temp_pred_ON = 1; % Whether to use temp. pred. for indiv. or not ( ON == 1; OFF == 0) x = x_vec(1); C_at = x_vec(2); C_oc = x_vec(3); C_veg = x_vec(4); C_so = x_vec(5); T = x_vec(6); %%% Initial c...
% % clc % % clear clc clear for ii = 1:p:r-p+1 for jj = 1:p:c-p+1 matrix_gen = HH(ii:ii+p-1,jj:jj+p-1); [co1(ii:ii+p-1,jj:jj+p-1)] = enc_edgy(matrix_gen,val(:,:,val_v)); count2=count2+1; count = count+1; if(count>=z1) break; end %LH ...
function [pupil,fbs]= fbspupil(npix, nmodes, Npix, lambda, error, rnphot) %% Fourier Mode Generator [fbs]=makefbs(npix,nmodes); mask=zernike(0,0,npix); fbs=fbs.*mask; %% Normalize fourier modes fsz=size(fbs); for i=1:fsz(3) fbs(:,:,i)=fbs(:,:,i).*sqrt(1/sum(sum(fbs(:,:,i).*fbs(:,:,i)))); end %% Make into complex P...
function outdata = subfnReturnBootStrapData(indata, samples) if nargin == 1 N = length(indata.Y); % find the number of groups if stratified resampling will be done if ~isempty(indata.STRAT) Gr1 = find(indata.STRAT == 0); NGr1 = length(Gr1); Gr2 = find(indata.STRAT == 1); NGr2...
function [ x ] = ValidateImage( imagePath ) image = imread(imagePath); image = FaceDetection(image); [R C] = size(image); if(R == 0 && C == 0) x = 0 else x = 1 end end
% For all the test follows, enumNonhydroBoundaryCondition.Zero % corresponds to the eidtype of boundary edge flaged to be -1, for those % boundary edge point, the non-hydrostatic pressure there is set to be % zero. Likewise, enumNonhydroBoundaryCondition.ZeroGrad corresponds to the % same edge point with the non-hydros...
function history=BotHistory(bots) % BOTHISTORY Saves current bot attributes into "history" record history(:,1)=[bots.x]; history(:,2)=[bots.y]; history(:,3)=[bots.p]; history(:,4)=[bots.q]; history(:,5)=[bots.v]; end
runTrainSim = 1; writeTrainVideos = 0; generateNnData = 1; trainNetwork = 1; runSim = 1; if runTrainSim == 1 close all hidden; clear uArena; names = {'cyberzooCW' 'cyberzooCCW' 'cyberzooBucket'}; add_args = {0 0 0 0}; v_max = 3; % Simulate sim...
% deblurring of the camera image using IST and various flavors of SpaRSA. close all clear clf f = double(imread('Camera.tif')); [m n] = size(f); scrsz = get(0,'ScreenSize'); figure(1) set(1,'Position',[10 scrsz(4)*0.05 scrsz(3)/4 0.85*scrsz(4)]) subplot(3,1,1) imagesc(f) colormap(gray(255)) axis off axis equal title...
function [Mono,V]=swr_preprocessing(CORTEX,states,fn) %Band pass filter design: Wn1=[100/(fn/2) 300/(fn/2)]; % Cutoff=100-300 Hz [b1,a1] = butter(3,Wn1,'bandpass'); %Filter coefficients Wn1=[320/(fn/2)]; % Cutoff=320 Hz [b2,a2] = butter(3,Wn1); %Filter coefficients %Convert signal to 1 sec epochs. ...
function outputImg = imscramble(inputimg) imgGray = mat2gray(double(inputimg)); % read and rescale (0-1) image imgSize = size(imgGray); % generate random phase structure randPhase = angle(fft2(rand(imgSize(1), imgSize(2)))); for layer = 1:imgSize(3) imgFourier(:,:,layer) = fft2(imgGray(:,:,layer)...
%% Monocular Camera Sensor Design:単眼カメラモジュールの動作モデル % 白線と車両の検出・ワールド座標で結果出力 % 自車と障害物までの距離の推定 % Copyright 2016 The MathWorks, Inc. clc;clear;close all;imtool close all; %% カメラ内部と配置のパラメータを設定(monoCameraクラス:imageToWorld, worldToImage メソッド(点座標の変換)を提供) % カメラキャリブレーションで求めたカメラ内部パラメータを設定(専用クラス) % (レンズ歪が少ないため、ここではレンズ歪補正はなし) fo...
function ConfusionMatrix( res_dir_name, out_file_name, print_flag ) %% Dictionary of actions file_name = 'action_label.txt'; fileID = fopen(file_name); data = textscan(fileID,'%s'); fclose(fileID); DICT = containers.Map; AL{length(data{1}),1} = ''; for i=1:length(data{1}) DICT(data{1}{i}) = i; AL{i,1} = data{1}{i...
%% ======================================================================== %% BASIC SETUP %% BASIC SETUP %% BASIC SETUP %% BASIC SETUP %% %% BASIC SETUP %% BASIC SETUP %% BASIC SETUP %% BASIC SETUP %% %% BASIC SETUP %% BASIC SETUP %% BASIC SETUP %% BASIC SETUP %% %% ====================================================...
function x1=prodsum(A,x,B,u) x1=x*A+u*B; end
function t = canshuhua(M,d) %UNTITLED2 此处显示有关此函数的摘要 % 此处显示详细说明 t(1)=0;%开始参数化 ti i=1,2...,M+1 ds=0; for j=1:M ds=ds+norm(d(j+1,:)-d(j,:))^0.5; end for i=1:M t(i+1)=t(i)+norm(d(i+1,:)-d(i,:))^0.5/ds; end%参数化完成 end
function drawgeo(filename, rot, lcolor, scale); if nargin < 3 lcolor = 'k'; end if nargin < 4 scale = 1; end points = []; lines = []; arcs = []; rmid = 0.07251; xoff = 0; rso = 0.11795; fid = fopen(filename, 'r'); while ~feof(fid) so = readline(fid); so(find(so==' ')) = []; s = so; for ind_s =...
function [accuracy are_pairs] = are_groups_pairs(BIRDS,PEDIGREE,groups,year) n = length(groups); are_pairs = zeros(n,1); iterator = 0; for i=1:n if length(groups{i})==2 iterator = iterator+1; x = groups{i}(1); y = groups{i}(2); are_pairs(iterator) = PEDIGREE.is_pair(BIRDS,x,y,year);...
function summa=plus(A,B) if isnumeric(B) summa=A; summa.c(summa.m0ind,summa.n0ind)=get00(A)+B; elseif compatible(A,B) summa.m=A.m; summa.n=A.n; summa.m0ind=A.m0ind; summa.n0ind=A.n0ind; summa.c=A.c+B.c; summa.s=A.s+B.s; summa=mnmat(summa); else error('A and B not compatible') end
function signal = create_signal(sinusoids,noise_amp, len_sign, Fs) % Takes the sinusoids and noise_amp variable and turn them into a signal % which lenght correspond to signal length. % sinusoids : [freq, phase, amp] % noise_amp : noise amplitude % len_sign: signal's lenght in second % Fs : sample frequency ...
function interpolator(bore1,strk1,etype,bore2,strk2,trq_vec,spd_vec,sfc,no,hc,co,new_filename) %this function was converted from fortran to MATLAB code by Sam Sprik of NREL in December 2001 %Original fortran code is described below %bore and strokes in cm, etype=1,2,or 3, map=, trq_vec in N, spd_vec in rad/s %no,hc,co...
clc;clear; im = imread('Syros_Ermoupolis.jpg'); sigma_start = 1; sigma_end = 15; R_DOF_start = 500; R_DOF_end = 700; R = size(im,1); sigma = ones(R,1); filt_size = ones(R,1); im1 = im; im_red = im(:,:,1); im_green = im(:,:,2); im_blue = im(:,:,3); k = zeros(R_DOF_start-2,1); for j = 0:R_DOF_start-2 k...
% Laboratorium nr 3 % 1. Probkowanie setenv GNUTERM 'x11' F = 1000; T = 1; A = 1; zak = 300; baseFpr = 10000; function [] = probkowanie(F, T, A, fpr, base, zak, j) figure(j); [t,y] = sinus(A, F, fpr, 0, T); subplot(3,1,1); if (fpr == base) plot(t(1:1000), y(1:1000)) else plot(t, y); endif title(["fpr =...
%% Stelling 21 % % Het aanmaken van een numerieke vector kan voor een % Bewegingstechnoloog handig zijn om bijvoorbeeld een % tijdvector aan te maken (een vector bestaande uit % tijdstippen). % Antwoord = 1;
%Get the current for the environment % state 1: No car visible in nearby tiles (horizon 1) % state 2: car visible on left tile % state 3: car visible on front tile % state 4: car visible on right tile function state=Q_getState(map, position) global mapSize; x=position(1)-1; y=position(2); state=1; %def...
function lineH = notePlot(note, timeUnit, color, startTime) %notePlot: Plot note-format music sequence % Usage: notePlot(note, timeUnit) % note(1:2:end): Semitone in MIDI representation % note(2:2:end): Duration in timeUnit second % (Default value for timeUnit is 1/64 seconds.) % % Example: % pitch=[68 65 65 66 63...
options={'existing_data','overwrite','warning_pause=0','debug_mode=50',... 'skip_write_civm_raw','write_unscaled','skip_filter','use_new_bruker_padding','skip_mem_checks'};%,'ignore_errors'};%,'ignore_kspace_oversize'}; try % 128 scott %[success_status_jcnUTE3D,img_jcnUTE3D, data_buffer_jcnUTE3D]=rad_mat('nemopv6'...
function [ min,max,name ] = Prompting %Prompting will prompt user for max and min temps max = input('Input the max temp in degrees F'); min = input('Input the min temp in degrees C'); if min > max [max,min] = Switch(max,min); end name = input('Input name of file to be made','s'); end
initialization; for dataset = datasets [X, y] = load_data(char(dataset)); if sum(sum(ismissing(X)))>0 fprintf('%s exists missing data\n', char(dataset)); end X = rmmissing(X); end
timeperiod=[0 1000]; label_win={'1s_windows'}; trblocks=[1]; exblocks=[2 3]; outblocks=[4 5]; n_con_ex=60; clear dm Res_in Res_out code_louk_asynch_gen gawd1=dm; gawd1sav=dmsav; gawdR1o=Res_out; gawdR1i=Res_in; gawd1perf=perfcomp(gawd1,'out','dec',1); gawd1cal=calperf(gawd1,'out','dec'); trblocks=[2]; exblocks=[1 3...
close all; clear; clc; bits_tx = randi(2,100,1)-1; [encoded_bits,H] = ldpc_encoder(bits_tx); % encoded_bits' a = randi(5,1,1); bits_corr = encoded_bits; for i = 1:length(a) bits_corr(a(i)) = not(bits_corr(a(i))); end % bits_corr' err = encoded_bits - bits_corr; e1 = sum(abs(err)) mod = 2*bits_corr - 1; sigma = 0...
function g = CNOT(control_q, target_q) % CNOT % Copyright 2017 Yulin Wu, University of Science and Technology of China % mail4ywu@gmail.com/mail4ywu@icloud.com import sqc.op.physical.gate.* g = Y2m(target_q)*CZ(control_q,target_q)*Y2p(target_q); g.setGateClass('CNOT'); end
function desiCallbacks(~,~,fig,defP) %desiCallbacks - update the toolbar's callback functions in here % This is for reloading an already analysed dataset %set(fig.tb.new,'ClickedCallback',{@desiFileUpload,fig,defP}); set(fig.tb.new,... 'ClickedCallback',{@desiDrawSideMenu,fig,{@desiFileUpload,fig,defP}}); % Tripl...
function [S,info] = ssr2D3D_alm(W,B,lam,beta,varargin) tol = 1e-3; refine = false; verb = true; if nargin < 4 beta = inf; end ivargin = 1; while ivargin <= length(varargin) switch lower(varargin{ivargin}) case 'tol' ivargin = ivargin + 1; tol = varargin{ivargin}; case '...
function [ XE5,dXE5 ] = XE5( context, H ) %XE5 ELECTRON DENSITY FOR THE E AND VALLEY REGION % REAL FUNCTION XE5(H) % ELECTRON DENSITY FOR THE E AND VALLEY REGION (HME..HEF). % LOGICAL NIGHT % COMMON /BLOCK4/ HME,XNME,HEF % & /BLOCK5/ NIG...
function plotData(X, y) %PLOTDATA Plots the data points X and y into a new figure % PLOTDATA(x,y) plots the data points with + for the positive examples % and o for the negative examples. X is assumed to be a Mx2 matrix. % Create New Figure figure; hold on; % ====================== YOUR CODE HERE ===============...
% startup script. if exist('../startup_ahf.m', 'file') run('../startup_ahf.m'); end addpath([projroot '/matlab/low/1d']) %#ok<*MCAP> addpath([projroot '/matlab/low/2d']) addpath([projroot '/matlab/low/3d']) addpath([projroot '/matlab/low/mixed']) addpath([projroot '/matlab/mid/1d']) addpath([projroot '/matlab/mid/2d...
%Helper for Ex 16, 17, 18; Andrew Banman %Function to generate the lazyWitness homology from a distance matrix and a choice of field coefficients function intervals = lazyWitness(distances, coeff_dim,file_name) import edu.stanford.math.plex4.*; import edu.stanford.math.plex_viewer.*; nu = 1; num_lpt = 50; num_div = 10...
function a = setPressure(a,p) % SETPRESSURE Set the pressure [Pa]. % % The pressure is set by changing the density holding the % temperature and chemical composition fixed. % if p <= 0.0 error('the pressure must be positive') end thermo_set(a.tp_id,1,p);
function [n_algae, n_dissolved, n_sediment, vol_areas, L_bottom] = Nutrient_content(A,Rd,Rs,p) %% Total nutrient density of the system at t=0 (to be conserved) n_sediment = zeros(1,p.Xn-1); n_algae = zeros(p.Yn-1,p.Xn-1); n_dissolved = zeros(p.Yn-1,p.Xn-1); vol_areas = zeros(p.Yn-1,p.Xn-1); L_bottom = zeros(p.Xn-1,1)...
function show_all_figs(res,plot_idx) figure(res.fig.pos()); plotList = {res.fig.eff_hip,res.fig.eff_kne,res.fig.eff_ank,res.fig.eff_hk,res.fig.eff_ha,res.fig.eff_ka}; for i=1:length(plot_idx) plotList{1,plot_idx(1,i)}(); end % figure(res.fig.eff_hip()); % figure(res.fig.eff_kne()); % figure(res.fig.eff_ank()); % f...
%DEFINEMODELITUOBSBYWOODLAND % % Yaguang Zhang, Purdue, 05/07/2021 % ITU-R P.833-9 obstruction by woodland model. Note that we do not % differentiate the signal polarization here. modelItuObsByWoodland.refParameterValues.freqInMHz ... = [105.9, 466.475, 949.0, 1852.2, 2117.5]; % Specific attenuation, gamma, in dB/...
clear; % 清除工作区变量 clc; % 清除命令行窗口 warning('off') % 忽略警告 n = 10; % 设定种群数量 ger = 20; % 设定进化代数 mygafit = zeros(1,15); psofit = zeros(1,15); for i = 1:15 fitness_best1 = myga(n,ger,[-5 -5],[5 5]); % 使用遗传算法优化 fitness_best2 = pso(n,ger,[-5 5;-5 5]); % 使用粒子群算法优化 mygafit(i) = max(fitness_best1); psofit...
function [x_final,t] = newton_search(x,d,G,H) % x: start point % d: search step % J: funtion % G,H: gradient and hessian t=0; for i=1:50 grad = G(x+d*t); hess = H(x+d*t); g = grad'*d; h = d'*hess*d; t = t - g/h; %fprintf('t=%f\n',t); end x_final = x+d*t; end
function [x,runningAvg,error] = ConsensusRobustv2(n,dim,packetloss,iterations,k) %Variables n; %number of nodes k; %number of standard iterations: corrective iterations packetloss_lambda = packetloss; %mean packets dropped per iteration iterations; %iterations of consensus averaging k; %number of standard consensus ite...
function Interpolated_line_positions = interp_equi(Points_position,Segment_length) % Interpolate N-D points to form a line. The segments of the line have a % length of Segment_length. % Points are assumed to be ordered. % Input % Points_position = N x N_d array representing the N_d-D positions of N points. % Segment_l...
1; % Start of Global Script global len_prox = 44.6; global len_inter = 26.3; global len_distal = 17.4; global lb_angle_prox = -pi /3; global lb_angle_inter = -2*pi/3; global lb_angle_distal = -2*pi/3; global ub_angle_prox = pi/3; global ub_angle_inter = 0; global ub_angle_distal = 0; global error_margin = 0....
close all clear all clc % ------------------------------------------------ % datos % largo de la barra L=1; % cantidad de nodos M=1; % variable simbolica syms x; % define la matriz K y el vector f K=zeros(M); f=zeros(M,1); % calcula los valores de K y f for l=1:M % K for m=1:M ...
function [C, sigma] = dataset3Params(X, y, Xval, yval) %DATASET3PARAMS 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] = DATASET3PARAMS(X, y, Xval, yval) returns your choice of C and % sigma. You...
% cmd: rosinit('127.0.0.1') % cmd: rosshutdown x_base = [0 0.76 0.76 0 0]; y_base = [-0.04 -0.04 1.80 1.80 -0.04]; plot(x_base, y_base, 'b') axis([-0.04 0.80, -0.08 1.84]); x_robot_before = 0; sist_plot = 0; have_plotted = false; X_before = 0; Y_before = 0; X = 33.5; Y = 0; WIDTH = 0.76; RADII = 0.04; h...
#computes the solution for one iteration of least squares to align a set of points onto another #Pi: the 6xN matrix of reference points with normal #Pj: the 6xN matrix of current points with normal #Omega: the information matrix of the points, assumend to be the same for all #X: the isometry of the transformation # # X...
function val = pseudoRsq(ll, llSat, llNull) if numel(ll) > 1 || numel(llSat) > 1 || numel(llNull) > 1 x=1; end if any(isnan([ll llSat llNull])) x=1; end if llSat < llNull x=1; end if llSat < ll x=1; end assert(llSat >= llNull); assert(llSat >= ...
function img_combine = mrir_array_combine(img_multichan, METHOD, varargin) %MRIR_ARRAY_COMBINE % % img_combine = mrir_array_combine(img_multichan, METHOD); % TODO: return measure of phase compatible with root-sum-of-squares % combination, e.g., homodyne detection (Noll et al., 1991) % TODO: implement all special case...
function [syn,deltat,estParam,hyper_params]=synapse_xcorr(Tlist,hyper_params) % syn_params(1) = latency % syn_params(2) = time constant % syn_params(3) = weight if isfield(hyper_params,'bin_width') bin_width = hyper_params.bin_width; else bin_width = .00002; end % fit model options=[]; options.method = 'cg';...
function x = mynansum(x,dim) % mynansum [Not a public function] Sum implemented for data with in-sample NaNs. % % % Backend IRIS function. % No help provided. % -IRIS Macroeconomic Modeling Toolbox. % -Copyright (c) 2007-2017 IRIS Solutions Team. %***********************************************************...
%{ Jacob Leonard ITP 168 - Fall 2015 jaleonar@usc.edu Revision History Date Changes Programmer ------------------------------------------------- 9/27/2015 Original Jacob Leonard %} play = 'y'; decide = strncmpi(play,'Y',1); while decide == 1 fprintf('Series Approximations \...
%% Run this script to generate Fig. 3 from % % H. Blasinski, J. Farrell and B. Wandell; 'An iterative algorithm for spectral % estimation with spatial smoothing,' ICIP 2015, Quebec City % % Copyright, Henryk Blasinski, 2015 close all; clear all; clc; fName = fullfile(iterSpEstRoot,'Results','noisyLightScene.mat'); ...
function errory = wienerExp(er) if er==1 last=-7; else last=1; end errory=zeros(numel(-7:last),numel(-10:0.5:10)); Im=load('images.mat'); y2=Im.y2; [My2,Ny2]=size(y2); h=estMask(Im.x1,Im.y1); [Mh,Nh]=size(h); H=fft2(h,My2,Ny2); for i=-7:last a=10^i; if er==2 y2=Im.y...
function [ map ] = visualize_scanpath( image, scanpath, scanpath_times ) tpf=300; %if scanpath does not provide time, set default as 300 if nargin < 3 && size(scanpath,2) > 3 scanpath_times=scanpath(:,3:4); else f=1:size(scanpath,1); scanpath_times(:,1)=tpf.*f - tpf; scanpath_times(:,2)=tpf.*f; end fi...
function [result]=game() tableSize=input('Tablo Boyutu Giriniz: '); if(tableSize <10) tableSize=10; end % oyuncunun oyun hakkı rightToPlay=round((tableSize*tableSize)/3); % açık tahtanın tanımlanması openTable=zeros(tableSize+1,tableSize+1);% +1 sebebi 1 den tablo boyutuna kadar tablonun dış çerçevesinin oluştur...
function summation = GaussianQuad(a,b,N,f) % a = first point of integral % b = final point of interval % N = number of intervals % f = function wi = zeros(5,1); % pre-allocate vector sized 5 for wi values xi = zeros(5,1); % pre-allocate vector sized 5...
%% Stelling 15 % % In Matlab kun je alleen rijvectoren maken. % Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
clear;clc,close all; %% 建立机器人DH参数,初始状态为竖直状态 L1=Link('d',144,'a',0,'alpha',0,'modified'); L2=Link('d',0,'a',0,'alpha',pi/2,'offset',-pi/2,'modified'); L3=Link('d',0,'a',-264,'alpha',0,'modified'); L4=Link('d',106,'a',-236,'alpha',0,'offset',-pi/2,'modified'); L5=Link('d',114,'a',0,'alpha',pi/2,'modified'); L6=Link('d',...
%% Build link capacity function [ c_link ] = build_metrics(conn, wdm_order,tdm_order) c_link = zeros(size(conn,1),size(conn,1),wdm_order,tdm_order); for i = 1: wdm_order for j = 1:tdm_order c_link(:,:,i,j) = 1e9./tdm_order.*conn; end end % if (strcmp(type,'blocco_m')) || (strcmp(type,'lossless_m'))...
filefolder = 'C:\Users\praveen\Desktop\imgp\5\Input Images\'; imagefiles = dir(fullfile(filefolder,'*.*')); nfiles = length(imagefiles); for i=[6] filename = imagefiles(i).name; fullfilename = fullfile(filefolder,filename); im = imread(fullfilename); im = rgb2gray(im); im2 = im2b...
function [] = splitTimeMachineScan(inDir, dimensions, varargin) p = inputParser; p.addRequired('inDir', @ischar); p.addRequired('dimensions', [], @(x)validateattributes(x,{'numeric'},{'size',[1 2]}); p.addParameter('inFile', '', @ischar); p.addParameter('regions', 4, @isnumeric); p.parse(inDir...
function [t,w]=eulercauchy(fun,a,b,yt0,n)%la funcion Euler necesita lo sig: %fun: funcion a evaluar %rango de intervalos: a(valor inicial), b(valor final) %yt0= valor inicial de a evaluar cuando t=0 %n=num. de intervalos h=(b-a)/n; %esto es para saber a que paso se hacen los intervalos t(1)=a; %esto es para que se ap...
% function result = membrane_current_GHK(params, rho, V) % % Molecular flow across membrane for GHK flux equation. % % Inputs % params -> state of system % rho -> optional density if different from params.rho (mM = moles/m^3) % V -> optional voltages if different from params.rho (V) % % Output % r...
T = readtable('AOI_lookup.txt'); number = size(T,1); conditions = {'aois_N', 'aois_C', 'aois_H'}; for c = 1:numel(conditions) condition = conditions{c}; load([condition, '.mat']); % imports the pregenerated AOIs variable condition(1:3) = 'AOI'; AOI = eval(condition); X1 = zeros (number, 1); ...