| 1 | 1/1 | 返回列表 |
| 查看: 623 | 回復(fù): 0 | ||
H_LG銀蟲 (正式寫手)
|
[求助]
求高手將一個(gè)M函數(shù)轉(zhuǎn)換成mex文件或mex語法編寫的c代碼
|
|
如題,將以下程序進(jìn)行轉(zhuǎn)換 因?yàn)檫@個(gè)程序在我的matlab程序中多次調(diào)用,很耗時(shí)。 求高手解答或指點(diǎn)。 謝過! function [A]=OMPerr(D,X,errorGoal)%#codegen % ======================================================== % Sparse coding of a group of signals based on a given dictionary and specified representation % error to get. % input arguments: D - the dictionary % X - the signals to represent % errorGoal - the maximal allowed representation error % output arguments: A - sparse coefficient matrix. % ======================================================== [n,P]=size(X); [n,K]=size(D); E2 = errorGoal^2*n; maxNumCoef = n/2; A = zeros(size(D,2),size(X,2)); % h=waitbar(0,'OMP on each example ...'); for k=1:1 ,% waitbar(k/P); a=[]; x=X(:,k); residual=x; indx = []; a = []; currResNorm2 = sum(residual.^2); j = 0; while currResNorm2>E2 && j < maxNumCoef, j = j+1; proj=D'*residual; pos=find(abs(proj)==max(abs(proj))); pos=pos(1); indx(j)=pos; a=pinv(D(:,indx(1:j)))*x; residual=x-D(:,indx(1:j))*a; currResNorm2 = sum(residual.^2); end; if (~isempty(indx)) A(indx,k)=a; end end; % close(h); return;[ 來自科研家族 控制&圖像家族 ] |

找到一些相關(guān)的精華帖子,希望有用哦~
| 1 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 269專碩求調(diào)劑 +4 | 金恩貝 2026-03-21 | 4/200 |
|
|---|---|---|---|---|
|
[考研] 考研調(diào)劑 +3 | 呼呼?~+123456 2026-03-21 | 3/150 |
|
|
[考研] 311求調(diào)劑 +7 | 26研0 2026-03-15 | 7/350 |
|
|
[基金申請] 山東省面上項(xiàng)目限額評審 +3 | 石瑞0426 2026-03-19 | 3/150 |
|
|
[考研] 307求調(diào)劑 +3 | 余意卿 2026-03-18 | 3/150 |
|
|
[考研] 生物學(xué)一志愿985,分?jǐn)?shù)349求調(diào)劑 +3 | zxts12 2026-03-21 | 3/150 |
|
|
[考研] 求調(diào)劑 +3 | 白QF 2026-03-21 | 3/150 |
|
|
[考研] 085601調(diào)劑 358分 +3 | zzzzggh 2026-03-20 | 4/200 |
|
|
[考研] 能源材料化學(xué)課題組招收碩士研究生8-10名 +5 | 脫穎而出 2026-03-16 | 15/750 |
|
|
[考研] 化學(xué)求調(diào)劑 +4 | 臨澤境llllll 2026-03-17 | 5/250 |
|
|
[考研] 265求調(diào)劑 +9 | 梁梁校校 2026-03-17 | 9/450 |
|
|
[考研] 307求調(diào)劑 +10 | 冷笙123 2026-03-17 | 10/500 |
|
|
[考研] 一志愿華南師大 070300(化學(xué))304分求調(diào)劑 +3 | 0703武芊慧雪304 2026-03-18 | 3/150 |
|
|
[考研] 考研調(diào)劑求學(xué)校推薦 +3 | 伯樂29 2026-03-18 | 5/250 |
|
|
[考研] 317求調(diào)劑 +5 | 申子申申 2026-03-19 | 9/450 |
|
|
[考研] 329求調(diào)劑 +9 | 想上學(xué)吖吖 2026-03-19 | 9/450 |
|
|
[考研] 286求調(diào)劑 +6 | lemonzzn 2026-03-16 | 10/500 |
|
|
[考研] 有沒有道鐵/土木的想調(diào)劑南林,給自己招師弟中~ +3 | TqlXswl 2026-03-16 | 7/350 |
|
|
[考研] 一志愿南京大學(xué),080500材料科學(xué)與工程,調(diào)劑 +4 | Jy? 2026-03-16 | 4/200 |
|
|
[考研] 327求調(diào)劑 +6 | 拾光任染 2026-03-15 | 11/550 |
|