這是留言板-既然來了,就留個言再走吧!
由 養花種魚數月亮賞星星 於 2029年7月22日星期日
下午2:43 發表
Mathematica 教學:Searoute for Traveling Salesman Problem
由 戴忠淵 於 2025年7月29日星期二
上午10:01 發表

You can download searoute from
https://github.com/eurostat/searoute
.
port = {
{"Shanghai, China", 31.2304, 121.4737},
{"Guangzhou, China", 23.1291, 113.2644},
{"Rotterdam, Netherlands", 51.9225, 4.4792},
{"Antwerp, Belgium", 51.2194, 4.4025},
{"Valencia, Spain", 39.4699, -0.3763},
{"Los Angeles, USA", 33.7405, -118.2719},
{"New York/New Jersey, USA", 40.6687, -74.0451},
{"Savannah, USA", 32.0809, -81.0912},
{"Santos, Brazil", -23.9608, -46.3336},
{"Buenos Aires, Argentina", -34.6037, -58.3816},
{"Itajai, Brazil", -26.9101, -48.6703},
{"Tangier Med, Morocco", 35.8844, -5.5036},
{"Port Said, Egypt", 31.2653, 32.3019},
{"Durban, South Africa", -29.8587, 31.0218},
{"Melbourne, Australia", -37.8136, 144.9631},
{"Auckland, New Zealand", -36.8485, 174.7633},
{"Brisbane, Australia", -27.4698, 153.0251},
{"Singapore, Singapore", 1.3521, 103.8198},
{"Kaohsiung, Taiwan", 22.6273, 120.3014},
{"Busan, South Korea", 35.1796, 129.0756},
{"Hong Kong, China", 22.3193, 114.1694},
{"Tanjung Pelepas, Malaysia", 1.3673, 103.5386},
{"Jebel Ali, UAE", 25.015, 55.0633},
{"Colombo, Sri Lanka", 6.9271, 79.8612},
{"Felixstowe, UK", 51.9556, 1.3111},
{"Algeciras, Spain", 36.1408, -5.4562},
{"Vancouver, Canada", 49.2827, -123.1207},
{"Port Klang, Malaysia", 3.0089, 101.3678},
{"Laem Chabang, Thailand", 13.0846, 100.8956},
{"Tokyo, Japan", 35.6828, 139.7595},
{"Yokohama, Japan", 35.4437, 139.6380}
};
Export["/Users/yourname/Desktop/searoute/text.csv",
Insert[
Flatten@{#[[1,1]]<>" to "<>#[[2,1]],
Round[#[[1,3]],0.1],Round[#[[1,2]],0.1],
Round[#[[2,3]],0.1],Round[#[[2,2]],0.1]}&/@
Select[
Flatten[Table[{port[[i]],port[[j]]},
{i,Length@port},{j,Length@port}],1],
#[[1]]!=#[[2]]&
],
{"routename","olon","olat","dlon","dlat"},1]
];
RunProcess[{"java","-jar",
"/Users/yourname/Desktop/searoute/searoute.jar",
"/Users/yourname/Desktop/searoute/text.csv",
"-res","5","-panama","1","-suez","1"}]
route=Import["/Users/yourname/Desktop/searoute/out.geojson",
"Data"][[2,2]];
mypath=Flatten@{#[[2,2]],StringSplit["routename"/.#[[3,2]]," to "],
"distKM"/.#[[3,2]]}&/@route;
myrule=Rule@@@Transpose@{Tally[mypath[[All,2]]][[All,1]],
Range[Length@port]};
distMatrix=ParallelTable[If[i==j,Infinity,
ToExpression@Select[mypath/.myrule,
#[[2]]==i&&#[[3]]==j&][[1,-1]]],
{i,Length@port},{j,Length@port}];
tour=FindShortestTour[Range[Length@port],
DistanceFunction->(distMatrix[[#1,#2]]&)];
myline=ParallelTable[
If[i==j,{},Select[mypath/.myrule,#[[2]]==i&&#[[3]]==j&][[1,1]]],
{i,Length@port},{j,Length@port}];
myline=myline[[#[[1]],#[[2]]]]&/@Partition[tour[[2]],2,1];
GeoGraphics[{
Red,PointSize[Large],
Point[GeoPosition[port[[All,{2,3}]]]],
Blue,Thick,myline},
GeoRange->"World",
GeoCenter->GeoPosition[{20,-150}],
GeoRange->Quantity[180,"AngularDegrees"]
]
青春啊!
由 戴忠淵 於 2022年5月11日星期三
下午8:21 發表
用 JASP 輕鬆學 SEM:從基礎到應用
由 戴忠淵 於 2022年4月26日星期二
下午9:33 發表
JASP 統計軟體是由阿姆斯特丹大學 Eric-Jan Wagenmakers 教授領導的團隊,以 R 為核心所開發的
免費開源統計軟體,主要應用於心理及統計分析,相關的分析模組包含:平均數比較、實驗設計、迴歸與相關分析、探索性因素分析、驗證性因素分析(CFA)、結構方程式(SEM)、機械學習、神經網路等。
由於其設計理念為讓用戸熟悉並易於使用,故幾乎所有的分析模組都已視窗化,僅需要懂得相關的統計理論卽可輕易上手。有關 JASP 統計軟體的詳細説明可到官方網站參閲,https://jasp-stats.org/。JASP 統計軟體亦可由網站免費下載:
https://jasp-stats.org/download/
本年度統計分析教材以JASP 講義為主,JASP 統計軟體除了是免費開源外,該軟體以視窗的為主,學生只要能了解課堂上講授的統計分析及進階的驗證性因素分析、競爭模式、多群組比較、結構方程模型的理論後,卽可輕易執行上手。此外,JASP 統計軟體所産生的報表 及圖形皆以 APA 格式輸出,學生也能因此免除在茫茫報表中重新整理資料、繪製圖形,簡化發 表硏究成果及撰寫論文的流程。本教材相關檔案、資料檔及未來更新維護皆可由下列網址下載:https://github.com/chungyuandye/JASP-
Mathematica 教學: Prove that 3/8< (1-cos(x)/cos(x/2))/x^2< 4/Pi^2 for all 0< x < Pi/2
由 戴忠淵 於 2017年9月19日星期二
下午8:52 發表
KKTMinimize[obj_,eqns_,ineqns_,variables_]:=
Block[{myrule,lambda,u,\[Lambda],Lagrange,eqnu,ineqnlam,
eqnus,ineqnlams,kkteqns,kktvars,kktans},
myrule={z_[i_]:>ToExpression[ToString[z]<>ToString[i]]};
eqnu=u[#]&/@Range[Length@eqns];
ineqnlam=\[Lambda][#]&/@Range[Length@ineqns];
eqnus=If[Length@eqns>=1,eqns.eqnu,0];
ineqnlams=If[Length@ineqns>=1,ineqns.ineqnlam,0];
kktvars=Flatten@{variables,eqnu,ineqnlam}/.myrule;
Lagrange=obj-eqnus-ineqnlams;
kkteqns=Flatten@{Thread[D[Lagrange,{variables}]==0],
Thread[eqns==0],Thread[ineqns<=0],
Thread[ineqns*ineqnlam==0],Thread[ineqnlam<=0]}/.
myrule;
If[MemberQ[PolynomialQ[#,kktvars]&/@kkteqns[[All,1]],False],
Print["KKT限制式均需為多項式。"],
kktans=Reduce[kkteqns,kktvars,
Backsubstitution->True]/.{And->List,Or->List,
Equal->Rule};
If[Length@Dimensions@kktans==1,{obj/.kktans,
kktans},{obj/.#,#}&/@kktans]]];
Plot[(1-Cos[x]/Cos[x/2])/x^2,{x,0.-10,Pi/2},
PlotRange->{{0,Pi/2},{0.3,0.5}},Frame->True,
FrameTicks->{{{0.3,0.5,{3/8,"3/8"},{4/Pi^2,"4/Pi^2"}},
None},{{0,Pi/2},None}},
GridLines->{None,{3/8,4/Pi^2}},GridLinesStyle->Dashed]
D[(1-Cos[x]/Cos[x/2])/x^2,x]//Simplify
D[(1-(Cos[x/2]^2-Sin[x/2]^2)/Cos[x/2])/x^2,x]//Simplify
D[4-4Sec[x/2]+3xTan[x/2]-4Tan[x/2]^2+xTan[x/2]^3,x]//TrigExpand//Simplify
(D[(6x-2Sin[x/2]-4Sin[x]-2Sin[(3x)/2]+Sin[2x]),x]//TrigExpand)
/.{Sin[z_]:>a,Cos[z_]:>b}
KKTMinimize[6+4a^2+2a^4-b+9a^2b-4b^2-12a^2b^2-3b^3+2b^4,{},
{-a,-b,a-1/Sqrt[2],1/Sqrt[2]-b,b-1},{a,b}]
Limit[(1-(Cos[x/2]^2-Sin[x/2]^2)/Cos[x/2])/x^2,x->0]
Limit[(1-(Cos[x/2]^2-Sin[x/2]^2)/Cos[x/2])/x^2,x->Pi/2]
Let f(x)=(1-cos(x)/cos(x/2))/x^2. Taking the first derivative of f(x) with respect to x yields d/dx f(x)=cos(x/2)*g(x)/(2x^3),
where g(x)=x*tan^3(x/2)-4*tan^2(x/2)+3*x*tan(x/2)-4*sec(x/2)+4. Because g'(x)=1/4*sec(x/2)^2*h(x) and h'(x)=k(x)=2*sin^4(x/2)+4*sin^2(x/2)+2*cos^4(x/2)-3*cos^3(x/2)-4*cos^2(x/2)-cos(x/2)-12*sin^2(x/2) *cos^2(x/2)+9*sin^2(x/2) cos(x/2)+6. Let a=sin(x/2) and b=cos(x/2). By Karush-Kuhn-Tucker conditions, we know that k(x) reaches its minimum at a=0 and b=1. This, together with the facts that h(0)=0, g(0)=0, and f(0)=0, indicates that f(x) is increasing in x, which also implies that 3/8<(1-Cos[x]/Cos[x/2])/x^2<4 br="" completes="" proof.="" the="" this=""> 4>
Mathematica 教學: Prove that 1 - 3 s^2 + (1 + s^2) Cosh[s] >0.
由 戴忠淵 於 2017年9月18日星期一
下午11:55 發表
Plot[1-3s^2+(1+s^2)Cosh[s],{s,0,Pi},Frame->True]
SeriesCoefficient[1-3s^2+(1+s^2)Cosh[s],{s,0,n}]
Normal[Series[1-3s^2+(1+s^2)Cosh[s],{s,0,5}]]
Minimize[2-(3s^2)/2+(13s^4)/24,s]
Solve[D[2-(3s^2)/2+(13s^4)/24,s]==0,s]
Since the coefficient in the n-th order of the taylor series of 1-3s^2+(1 + s^2)Cosh[s] is positive for every even term and is
zero for every odd term for all n>=3, it is obvious to see that 1-3s^2+(1+s^2)Cosh[s]>2-(3s^2)/2+(13s^4)/24>25/26, which implies that 1-3s^2+(1+s^2)Cosh[s]>0. This completes the proof.
Mathematica 教學:非線性規劃
由 戴忠淵 於 2016年2月11日星期四
下午9:23 發表
Word 教學:合併列印並分別存檔
由 戴忠淵 於 2015年12月23日星期三
下午10:58 發表
Word 教學:合併列印
由 戴忠淵 於
上午9:57 發表
Word長篇文章基礎排版
由 戴忠淵 於 2015年11月23日星期一
下午3:23 發表
Mathematica 教學:主成分分析
由 戴忠淵 於 2015年8月15日星期六
下午5:30 發表
With[{data=
Block[{t},
{#,3+#*0.2+RandomReal[NormalDistribution[0,1]]}&/@
Table[RandomReal[NormalDistribution[0,2]],{100}]]},
Manipulate[
Module[{p1=point1,p2=point2,m,v1,myline,pp,pcadata,
pcaslope},
pcaslope=
Divide@@Reverse@Eigensystem[Covariance[data]][[2,1]];
(*直線斜率*)
m=(p2[[2]]-p1[[2]])/(p2[[1]]-p1[[1]]);
(*計算投影座標*)
v1=point2-point1//N;
pcadata=p1+Projection[#-point1,v1]&/@data;
Column[{
"最大特徵根="<>ToString@Eigensystem[Covariance[data]][[1,1]],
"變異數="<>ToString@Variance[Normalize[v1].#&/@data],
"",
Plot[{m(x-p1[[1]])+p1[[2]],
pcaslope(x-p1[[1]])+p1[[2]]},{x,-20,20},
PlotStyle->{{Green,Thickness[0.01]},Automatic},
PlotRange->{{-10,10},{-7.5,12.5}},
Axes->False,
Frame->True,
AspectRatio->1,
Epilog->{Blue,PointSize[0.0125],Point[data],
Red,PointSize[0.025],Point[pcadata],
Dashed,MapThread[Line[{#1,#2}]&,{data,pcadata}]},
ImageSize->300]},Alignment->Center]],
{{point1,{-1,-5}},Locator},
{{point2,{2,1}},Locator}]]
Finally, the first acceptance of 2015 comes.
由 戴忠淵 於 2015年1月15日星期四
下午6:08 發表
Chung-Yuan Dye and Chih-Te Yang
Abstract
In this paper, we consider issues of sustainability in the context of joint trade credit and inventory management in which the demand depends on the length of the credit period offered by the retailer to its customers. We quantify the impacts of the credit period and environmental regulations on the inventory model. Starting with some mild assumptions, we first analyze the model with generalized demand and default risk rates under the Carbon Cap-and-Trade policy, and then we make some extensions to the model with the Carbon Offset policy. We further analytically examine the effects of carbon emission parameters on the retailer's trade credit and replenishment strategies. Finally, a couple of numerical examples and sensitivity analysis are given to illustrate the features of the proposed model, which is followed by concluding remarks.
Keywords: Environmental regulation; Inventory; Trade credit; Default risk; Carbon emissions
Mathematica 教學:Central Limit Theorem 2
由 戴忠淵 於 2014年7月25日星期五
下午7:59 發表
Grid[{{Module[{x,xx,z,temp1,size1},
x={};temp1=1;size1=10;
xx:={(Mean[RandomReal[GammaDistribution[10,2],size1]]-20)*Sqrt[size1]/Sqrt[40]};
Dynamic[Column[{size1,
Histogram[temp1=temp1+1;
If[temp1<=300,x=Join[x,xx],size1=size1+1;temp1=1;x=xx],{-4,4,0.4},"PDF",
Frame->True,Axes->None,PlotRange->{{-4,4},{0,1}},
Epilog->First@Plot[PDF[NormalDistribution[0,1],z],{z,-4,4},PlotStyle->Red]]},
Center]]],
Module[{y,yy,temp2,size2},
y={};temp2=1;size2=10;
yy:={(Mean[RandomVariate[BinomialDistribution[10,0.2],size2]]-2)*
Sqrt[size2]/Sqrt[1.6]};
Dynamic[Column[{size2,
Histogram[temp2=temp2+1;
If[temp2<=300,y=Join[y,yy],size2=size2+1;temp2=1;y=yy],{-4,4,0.4},"PDF",
Frame->True,Axes->None,PlotRange->{{-4,4},{0,1}},
Epilog->First@Plot[PDF[NormalDistribution[0,1],z],{z,-4,4},PlotStyle->Red]]},
Center]]]}}]
Excel 教學 用函數抓每行最後一筆資料
由 戴忠淵 於 2014年2月7日星期五
下午12:00 發表
Mathematica 教學 統計檢定表格
由 戴忠淵 於 2014年1月27日星期一
下午6:17 發表
表格多的時候,這倒是個好方法~~
myTTest1[data_]:=Flatten@{ToString[NumberForm[Mean@data[[All,2]],{4,3}]]<>
"\[PlusMinus]"<>ToString[NumberForm[StandardDeviation@data[[All,2]],{4,3}]],
ToString[NumberForm[Mean@data[[All,3]],{4,3}]]<>"\[PlusMinus]"<>
ToString[NumberForm[StandardDeviation@data[[All,3]],{4,3}]],
If[Abs[#]>0.00002,NumberForm[#,{4,3}],"0.000"]&/@TTest[{data[[All,2]],
data[[All,3]]},0,{"TestStatistic","PValue"},VerifyTestAssumptions->"EqualVariance"]};
myTTest2[data_]:=Flatten@{ToString[NumberForm[Mean@data[[1,All,2]],{4,3}]]
<>"\[PlusMinus]"<>ToString[NumberForm[StandardDeviation@data[[1,All,2]],{4,3}]],
ToString[NumberForm[Mean@data[[2,All,2]],{4,3}]]<>"\[PlusMinus]"
<>ToString[NumberForm[StandardDeviation@data[[2,All,2]],{4,3}]],
If[Abs[#]>0.00002,NumberForm[#,{4,3}],"0.000"]&/@TTest[{data[[1,All,2]],
data[[2,All,2]]},0,{"TestStatistic","PValue"},VerifyTestAssumptions->"EqualVariance"]}
mydata1[data_,cond1_,cond2_]:=Block[{height,weight,bmi,x1,x2,x3,x4},
height=Select[data,#[[3]]==cond1&&#[[1]]==cond2&][[All,{1,5,8}]];
weight=Select[data,#[[3]]==cond1&&#[[1]]==cond2&][[All,{1,6,9}]];
bmi=Select[data,#[[3]]==cond1&&#[[1]]==cond2&][[All,{1,7,10}]];
x1=Heigt=Select[data,#[[3]]==cond1&&#[[1]]==cond2&][[All,{1,11,15}]];
x2=Heigt=Select[data,#[[3]]==cond1&&#[[1]]==cond2&][[All,{1,12,16}]];
x3=Heigt=Select[data,#[[3]]==cond1&&#[[1]]==cond2&][[All,{1,13,17}]];
x4=Heigt=Select[data,#[[3]]==cond1&&#[[1]]==cond2&][[All,{1,14,18}]];
{height,weight,bmi,x1,x2,x3,x4}
]
mydata2[data_,cond2_]:=Block[{height,weight,bmi,x1,x2,x3,x4},
height=Select[data,#[[1]]==cond2&][[All,{3,8}]];
weight=Select[data,#[[1]]==cond2&][[All,{3,9}]];
bmi=Select[data,#[[1]]==cond2&][[All,{3,10}]];
x1=Select[data,#[[1]]==cond2&][[All,{3,15}]];
x2=Select[data,#[[1]]==cond2&][[All,{3,16}]];
x3=Select[data,#[[1]]==cond2&][[All,{3,17}]];
x4=Select[data,#[[1]]==cond2&][[All,{3,18}]];
SplitBy[#,(#[[1]])&]&/@{height,weight,bmi,x1,x2,x3,x4}
]
mylabel1={{"身高","體重","BMI","姿體前彎","立定跳遠","仰臥起坐","心肺適能"},
{"前測","前測","T 值","P-Value"}};
mylabel2={{"身高","體重","BMI","姿體前彎","立定跳遠","仰臥起坐","心肺適能"},
{"男生","女生","T 值","P-Value"}};
TableForm[myTTest1/@mydata1[data,"男","實驗組"],
TableHeadings->mylabel1]
TableForm[myTTest1/@mydata1[data,"女","實驗組"],
TableHeadings->mylabel1]
TableForm[myTTest1/@mydata1[data,"男","對照組"],
TableHeadings->mylabel1]
TableForm[myTTest1/@mydata1[data,"女","對照組"],
TableHeadings->mylabel1]
TableForm[myTTest2/@mydata2[data,"實驗組"],TableHeadings->mylabel2]
TableForm[myTTest2/@mydata2[data,"對照組"],TableHeadings->mylabel2]
Mathematica 教學 多項式公因式分解
由 戴忠淵 於 2014年1月16日星期四
下午6:21 發表
common[exp_List]:=Block[{factor,tempexp,gcd},
(* 判斷是否為乘法,是的話因式分解;不是的話,加係數1在做因式分解 *)
(* 最後將乘法改成陣列 *)
tempexp=If[SameQ[Head@#,Times],Factor[#],
{1,Factor[#]}]&/@exp/.Times->List;
tempexp=Flatten/@tempexp;
(* 公因式 *)
factor=Intersection@@tempexp;
(* 係數的公因數 *)
gcd=GCD@@tempexp[[All,1]];
(* 輸出 *)
{Times@@factor*gcd,Times@@#/Times@@factor/gcd&/@tempexp}
]
Mathematica 教學 問卷項目分析
由 戴忠淵 於 2013年12月31日星期二
上午12:30 發表
ItemAnalysis[data_]:=
Block[{varname=data[[1]],mydata=data[[2;;-1]],sum,lower,
upper,testdata,testdatalow,testdatahigh,itemdata},
sum=Flatten@{#,Total[#]}&/@mydata;
lower=Quantile[sum[[All,-1]],0.25];
upper=Quantile[sum[[All,-1]],0.75];
testdata={sum[[#]],
If[sum[[#,-1]]>=upper,2,
If[sum[[#,-1]]<=lower,1,0]]}&/@Range[Length@sum];
testdata=GatherBy[testdata,Last];
testdatalow=Cases[testdata,{a_,1},Infinity][[All,1]];
testdatahigh=Cases[testdata,{a_,2},Infinity][[All,1]];
itemdata={Flatten@{varname[[#]],"低分組",
Length@testdatalow[[All,#]],
NumberForm[N@Mean@testdatalow[[All,#]],{5,4}],
NumberForm[N@StandardDeviation@testdatalow[[All,#]],{5,4}],
{NumberForm[#[[1]],{5,4}],NumberForm[If[#[[2]]<0.00001,0,#[[2]]],{5,4}]}&/@
{TTest[{testdatalow[[All,#]],testdatahigh[[All,#]]},0,"TestDataTable",
VerifyTestAssumptions->"EqualVariance"][[1,1,
2,{2,3}]]}},{"","高分組",Length@testdatahigh[[All,#]],
NumberForm[N@Mean@testdatahigh[[All,#]],{5,4}],
NumberForm[N@StandardDeviation@testdatahigh[[All,#]],{5,4}],
"",""}}&/@Range[Length@varname];
TableForm[Flatten[itemdata,1],
TableHeadings->{None,{"題項","組別","個數","平均數","標準差","T值","P-Vale"}}]]
(*用法*)
(*資料的第一列為變數名稱*)
ItemAnalysis[你的資料]
Mathematica 教學 Fun with SocialMediaData
由 戴忠淵 於 2013年12月26日星期四
上午12:00 發表
test=SocialMediaData["Facebook","FriendNetwork"]
test1=ToExpression[StringReplace[ToString@FullForm@test,"Graph["->"graph["]];
icondata={#[[1]],#[[2,1,2]],Import[#[[2,2,2]]]}&/@test1[[3,4,2]];
Graph@@(test1/.{test1[[3,-3,2]]->Apply[Rule,{#[[1]],
Placed[Image[#[[-1]],ImageSize->{30}],Center]}&/@icondata,{1}],test1[[3,-2,2]]->Tiny})
Mathematica 教學 行取最大值後,那一行列不再考慮
由 戴忠淵 於 2013年12月12日星期四
上午10:44 發表
myfun[data_]:=Block[{temp,tempdata=data,i},
temp[i_]:=Block[{x},
x=Position[tempdata[[All,i]],Max@tempdata[[All,i]]][[1,1]];
Set[tempdata[[x,i+1;;-1]],Table[-Infinity,{Length@tempdata-i}]];
tempdata];
Do[tempdata=temp[i],{i,Length@tempdata-1}];
Max[tempdata[[All,#]]]&/@Range[Length@tempdata]];
A={{15,20,17,27},{14,78,41,21},{32,14,12,14},{14,25,25,24}};
myfun[A]
Mathematica 教學 資料依指定區間分組
由 戴忠淵 於 2013年12月10日星期二
下午6:16 發表














![作者 goldberg73 (高柏) 看板 MATLAB 標題 [討論]行取最大值後,那一行列不再考慮?由左而右 時間 Thu Dec 12 09:28:12 2013 ─────────────────────────────────────── 假設有一A矩陣 4*4 A=[15 20 17 27; 14 78 41 21 ; 32 14 12 14 ; 14 25 25 24] 15 20 17 27 14 78 41 21 32 14 12 14 14 25 25 24 想要每一行取最大值,從第一行開始, 且出現最大值的那一列, 往後不予考慮 參與第二行取最大值... 由此類推 結果為: 32 (第一行的最大值為32 , 因此第二行取最大值,不考慮第三列) 78 (第二行的最大值是78, 因此第三行取最大值 不考慮第三列 和第二列) 25 (第三行的最大值是25 , 因此第四行取最大值不考慮第四列 第三列和第二列) 27 (不考慮 第二 三 四列下, 第四行的值為27)](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLBQrTPRPYa2hqahVnGUww7ej7Ji2PXkkASy8MF3LPBiknq9r4IU1-x7iiUAWmCkmLYgjpYrPoUXqHcshOCkT6pSJAo8KdcoSavl-IJw3Nj3Q3g-h2CZh5DaCdE9zWEEiPbZmf3TmrcRY/s400/%E8%9E%A2%E5%B9%95%E5%BF%AB%E7%85%A7+2013-12-12+%E4%B8%8A%E5%8D%8810.42.45.png)
![作者 celestialgod (攸藍) 看板 MATLAB 標題 [運算] 給定區間分組 時間 Tue Dec 10 15:59:41 2013 ─────────────────────────────────────── data = randn(3670000,1); 我有一個區間是 -3 -2 -1 0 1 2 3 我想要把資料中小於-3分為第一組,界在-3跟-2之間分為第二組,剩下依此類推](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhS2rug0hqfWeEDtagJCR2zawAehnBY5L1mmo42dAFnBg0ws21yqrn7drmNaVyaMhj-m2VBwtlCUCp4nrMUTmZmLTcSJPXglkLWXgO5okUBCs4ngehi48bLv_F_jMZrCnm2BJOAD_FAOkw/s400/%E8%9E%A2%E5%B9%95%E5%BF%AB%E7%85%A7+2013-12-10+%E4%B8%8B%E5%8D%886.15.54.png)