科学网

 找回密码
  注册
科学网 标签 function 相关日志

tag 标签: function

相关日志

COMSOL with MATLAB 帮助文件例子
Daniel1985 2013-3-17 11:38
创建 *** 所包围的 function函数 *********************************************** function modelParam(model,filepath) filename = fullfile(filepath,'results.txt'); fid=fopen(filename,'wt'); fprintf(fid,'*** run parametric study ***\n'); fprintf(fid,'L | tbb | Vtot | '); fprintf(fid,'MaxT | TotQ | Current \n'); maxop1 = model.cpl.create('maxop1','Maximum','geom1'); maxop1.selection.set(1); % 避免内存过大,选择清除每次迭代的历史记录 model.hist.disable; for L = model.param.set('L',L); for tbb = model.param.set('tbb',tbb); for Vtot = model.param.set('Vtot',Vtot); fprintf(fid, ); model.sol('sol1').run; MaxT = mphglobal(model,'maxop1(T)'); TotQ = mphint(model,'jh.Qtot','selection',1); Current = mphint(model,'jh.normJ',... 'edim',2,'selection',43); fprintf(fid, ); modelName = fullfile(filepath, ); model.save(modelName); end end end fclose(fid); ************************************************** 打开 COMSOL with MATLAB 因为这一例子是基于现有模型的 比如先导入一个busbar.mph模型 filepath 需要指保存建模型的位置 比如'D:\COMSOL' model=mphload('busbar'); modelParam(model,'filepath')
个人分类: MATLAB/COMSOL|13062 次阅读|0 个评论
长生不老药有没有?人类可望150岁
热度 3 xupeiyang 2013-3-12 14:20
白藜芦醇抗衰老作用的国际研究进展与文献分析 检索分析用词 SIRT1 and resveratrol Aging 信息分析平台 http://www.gopubmed.org/web/gopubmed/1?WEB0fepw17wls3d5I0I1I00h001000j10021000300.y Term: Aging Description: The gradual irreversible changes in structure and function of an organism that occur as a result of the passage of time. Synonyms: Biological Aging, Senescence 文献分析结果如下: Top Years Publications ‍ 2010 29 ‍ 2012 23 ‍ 2008 14 ‍ 2009 12 ‍ 2011 9 ‍ 2007 7 ‍ 2005 4 ‍ 2006 3 ‍ 2003 3 ‍ 2013 2 ‍ 2004 1 1 2 Top Countries Publications ‍ United States 39 ‍ China 10 ‍ Japan 8 ‍ France 8 ‍ Spain 4 ‍ South Korea 4 ‍ Australia 4 ‍ Italy 4 ‍ Taiwan 4 ‍ United Kingdom 3 ‍ Netherlands 2 ‍ Thailand 2 ‍ Canada 2 ‍ Hong Kong 1 ‍ Chile 1 ‍ Switzerland 1 ‍ Greece 1 ‍ Finland 1 ‍ Poland 1 ‍ Sweden 1 1 2 1 2 3 4 Top Cities Publications ‍ Farmington 6 ‍ Boston 4 ‍ Sydney 4 ‍ Taipei 4 ‍ Barcelona 3 ‍ Philadelphia 3 ‍ Beijing 3 ‍ New York City 3 ‍ Rochester 3 ‍ Paris 3 ‍ Tianjin 2 ‍ Bethesda 2 ‍ Fukuoka 2 ‍ Tokyo 2 ‍ Kantharalak 2 ‍ Lyon 2 ‍ Seoul 2 ‍ Cambridge 2 ‍ Montréal 2 ‍ Hong Kong 1 1 2 3 4 1 2 3 4 5 Top Journals Publications ‍ Plos One 4 ‍ Biochim Biophys Acta 4 ‍ Mech Ageing Dev 3 ‍ Aging 3 ‍ Biochem Biophys Res Commun 3 ‍ Cell 3 ‍ Arterioscler Thromb Vasc Biol 3 ‍ Nature 3 ‍ Age (dordr) 2 ‍ Free Radic Biol Med 2 ‍ J Biol Chem 2 ‍ Heart Fail Rev 2 ‍ Altern Med Rev 2 ‍ Arch Biochem Biophys 2 ‍ Curr Aging Sci 2 ‍ Int J Mol Med 2 ‍ Hum Reprod 1 ‍ Cell Metab 1 ‍ Am J Physiol Heart Circ Physiol 1 ‍ Biochem Pharmacol 1 1 2 3 4 5 1 2 3 ... 33 Top Authors Publications ‍ Morris B 3 ‍ Mukherjee S 2 ‍ Das D 2 ‍ Guarente L 2 ‍ Puigserver P 2 ‍ Sinclair D 2 ‍ Liu L 1 ‍ Liu M 1 ‍ Yin Y 1 ‍ Ye X 1 ‍ Zeng M 1 ‍ Zhao Q 1 ‍ Keefe D 1 ‍ Zhou Z 1 ‍ Liu B 1 ‍ Ghosh S 1 ‍ Yang X 1 ‍ Zheng H 1 ‍ Liu X 1 ‍ Wang Z 1 1 2 3 ... 33 1 2 3 ... 76 Top Terms Publications ‍ NAD-dependent deacetylase sirtuin-1 80 ‍ Humans 78 ‍ Stilbenes 73 ‍ Animals 73 ‍ Sirtuins 69 ‍ Longevity 67 ‍ Aging 60 ‍ Proteins 50 ‍ Mice 42 ‍ Unknown term default#fulltext 41 ‍ trihydroxystilbene synthase activity 39 ‍ Genes 37 ‍ Metabolism 37 ‍ metabolic process 37 ‍ Caloric Restriction 32 ‍ Unknown term default#review 32 ‍ NAD 31 ‍ Cell Aging 24 ‍ senescence 24 ‍ Histone Deacetylases 24 1 2 3 ... 76 publications over time world map network of top authors Top 20 of Important Phrases 1. sirtuin 1 browse it with it or it without it 85 2. in vitro browse it with it or it without it 84 3. oxidative stress browse it with it or it without it 59 4. histone deacetylase browse it with it or it without it 46 5. protein kinase browse it with it or it without it 43 6. gene expression browse it with it or it without it 38 7. caloric restriction browse it with it or it without it 30 8. transcription factor browse it with it or it without it 28 9. insulin sensitivity browse it with it or it without it 27 10. insulin resistance browse it with it or it without it 25 11. endothelial cells browse it with it or it without it 25 12. cell survival browse it with it or it without it 24 13. cell death browse it with it or it without it 22 14. stem cells browse it with it or it without it 20 15. health benefits browse it with it or it without it 19 16. cell lines browse it with it or it without it 18 17. adipose tissue browse it with it or it without it 17 18. skeletal muscle browse it with it or it without it 17 19. neuroprotective effects browse it with it or it without it 17 20. animal models browse it with it or it without it 14 1. Stilbenes/pharmacology browse it with it or it without it 267 2. Sirtuins/metabolism browse it with it or it without it 263 3. Sirtuin 1/physiology browse it with it or it without it 188 4. Sirtuin 1/metabolism browse it with it or it without it 157 5. Sirtuins/genetics browse it with it or it without it 139 6. Sirtuin 1/genetics browse it with it or it without it 85 7. Antioxidants/pharmacology browse it with it or it without it 75 8. Gene Expression Regulation/drug effects browse it with it or it without it 65 9. Stilbenes/therapeutic use browse it with it or it without it 61 10. Sirtuins/antagonists inhibitors browse it with it or it without it 49 11. Signal Transduction/drug effects browse it with it or it without it 42 12. Enzyme Inhibitors/pharmacology browse it with it or it without it 39 13. Apoptosis/drug effects browse it with it or it without it 34 14. Enzyme Activation/drug effects browse it with it or it without it 31 15. Oxidative Stress/drug effects browse it with it or it without it 30 16. Reactive Oxygen Species/metabolism browse it with it or it without it 27 17. Sirtuin 1/antagonists inhibitors browse it with it or it without it 26 18. Forkhead Transcription Factors/metabolism browse it with it or it without it 25 19. Acetylation/drug effects browse it with it or it without it 23 20. Niacinamide/pharmacology browse it with it or it without it 23 数据来源 http://pubmedpro.cn/Pubmed/Statistic 白藜芦醇(resveratrol,简称Res)是非黄酮类的 多酚化合物 ,天然的白藜芦醇在很多植物中存在,是植物为了抵御病菌入侵而产生的一种抗毒型物质。研究发现白藜芦醇是某些 草药 治疗炎症、脂类代谢紊乱和心脏疾病等的有效成分。随着对白藜芦醇的深入研究,显示白藜芦醇具有抗癌、抗氧化、 抗菌 、抗炎以及预防食物过敏等作用,可广泛地应用于医药、保健品、食品、化妆品等领域。 【新药或帮助人寿命延长至150岁】如何延长人的寿命一直是许多科学家研究的目标。据媒体报道制药巨头葛兰素史克正在测试部分新药,如果成功或许能让人的预期寿命延长至150岁。主要成分是人工合成的白藜芦醇,通过促进被称为长寿基因的SIRT1组蛋白脱乙酰酶活力,起到延缓衰老作用。 http://t.cn/zjn3LoG 英国制药巨头正在研制抗老新药 有望延寿150岁 动物测试:实验白鼠寿命延长15%   尽管针对白藜芦醇的研究已经开展了有10年之久,但相关领域的科学基础方面一直存在争议。   不过,人工合成的白藜芦醇在一些病症的临床测试中已经显现出令人满意的效果,并且这些病症包括癌症、心血管疾病、心力衰竭、2型糖尿病、老年痴呆症、帕金森症、脂肪肝、白内障、骨质疏松、关节炎等各种与年龄衰老有关的病症。   参与这一研发项目的哈佛大学遗传学教授戴维·辛克莱尔说:“从根本上来说,这些药物能够治疗某种病症,但与当前药物不同之处在于,它们还可以预防20种其他病症。实际意义上来说,它们可以延缓衰老。 ”   据悉,这些人工合成 “活化剂”已经在有限范围内使用于2型糖尿病患者和牛皮癣患者的临床治疗方面。科研人员发现,这些药物对2型糖尿病患者的新陈代谢带来了好处,并且让牛皮癣患者的皮肤减少变红的症状。   而在动物测试中,体重超标的实验白鼠在使用人工合成白藜芦醇后,其运动能力甚至达到了普通白鼠的两倍,并且寿命也长了15%。 http://news.sohu.com/20130312/n368468265.shtml 白藜芦醇抗衰老机理阐明 港大目标直指抗衰老药 http://www.biodiscover.com/news/hot/research/103322.html 纽约时报披露红酒抗衰老论文造假 http://www.biodiscover.com/news/hot/research/100452.html 科学家称发现"长生不老药" 人能活到1000岁 http://society.stnn.cc/qiwen/201010/t20101009_1428943.html
个人分类: 科研动态|2098 次阅读|4 个评论
谁为女性科研人员做点啥?
热度 3 pigpig 2013-3-8 19:46
女性在高层次科研工作者中的占比偏低,是有目共睹的事实。谁能 联合更多的有识之士、媒体单位、企业商家及相关组织共同为女科学家创造更好的条件,帮助女性取得更多的发展条件。 女性,工作认真、耐心、细心、乐于合作,在许多方面明显不同于男性。更富多样性的"科学研究生态系统",必然会更多的产出。相关的调研数据也表明,大多数男性科学家希望增加女性科研伙伴。 好的。身为一个女性,在三八节这样的日子,想起了我的诸位博士师姐的血泪史,即使当了老师,依然心酸,不禁想问:谁可以为女科学家做些什么? 1、创造交流机会 为女科学家提供更多的学术交流机会。学术会议组委会可为女科学家发出更多的学术报告邀请,安排更好的报告场次,吸引更多的企业为女科学家提供学术旅行资助。 2、介绍科研成果及实验室 媒体及其他传播机会都可以更多地介绍女科学家的科研成果。这将为女科学家提供更多的交流机会,也有利其实验室招生、招聘。 3、讲述科研故事 同样,媒体可以通过新闻、专题报道、人物访谈等方式讲述女科学家的科研故事,科研感想。这些故事将帮助更多的女性了解科研工作,吸引更多的女性勇攀高峰。 4、特别的折扣 科研试剂、仪器、耗材企业及其他服务企业可为女科学家提供特别的折扣。这样,女科学家的科研经费会更宽裕,也就可以进行更广泛、深入的科研探索。 (function(w, d, g, J) { var e = J.stringify || J.encode; d = d || {}; d = d || function() { w.postMessage(e({'msg': {'g': g, 'm':'s'}}), location.href); } })(window, document, '__huaban', JSON); 谁可以呢?
4777 次阅读|6 个评论
[请教] 我们的结果应该投哪个期刊?
热度 4 zlyang 2013-3-4 21:48
我们的结果应该投哪个期刊? 我们近年一共发现了 3 个 比当前国内外《数理统计学》教材中普遍使用的“ Fisher z 变换”更好的初等显式 函数 。 (1) 第一个 形式 特别简单,已经被《 Transactions of Tianjin University 》录用。这是EI核心期刊。 该函数的最大误差是“Fisher z 变换”的 70.7% ,累计误差为“Fisher z 变换”的 141% 。 该 Quadratic Radical Function 很简单,对改进某重要问题的计算机算法,有很好的作用。不排除将来进入《计算机算法设计与分析》之类书籍或教材的可能性。这个是不是有点 阿Q 了 ? (2) 第二个 形式略微复杂,已经被《 Communications in Statistics-Theory and Methods 》录用。目前是4区的SCI期刊。 该函数的最大误差是“Fisher z 变换”的 21.4% ,累计误差为“Fisher z 变换”的 8.90% 。 该 Sigmoid-like 函数首次胜过“Fisher z 变换”,不仅可以替换“Fisher z 变换”取得更好的精度,还对加深了解“Fisher z 变换”有重要的启发。 现在是 第三个 初等显式函数要投稿,不知道 投哪里 ?请您指教! 谢谢! 第三个函数 的最大误差约是“Fisher z 变换”的 18% ,累计误差约为“Fisher z 变换”的 4.7% 。 第三个函数的形式比第二个“应该”简单些。 除了我们的工作,Yun, Beong In 的 Approximation to the cumulative normal distribution using hyperbolic tangent based functions, Journal of the Korean Mathematical Society , 2009, 46(6): 1267-1276. 是近期的他人工作,里面有近几十年有 关工作的概述。这也是个4区的SCI期刊。 ————————— 相关背景 ————————— Sir Ronald Aylmer Fisher Photograph courtesy of Professor A W F Edwards by kind permission of Joan Fisher Box http://www.galtoninstitute.org.uk/Newsletters/GINL0306/university_of_cambridge_eugenics.htm 在《 大 英百科全书 , Encyclopaedia Britannica 》 http://www.britannica.com/EBchecked/topic/208658/Sir-Ronald-Aylmer-Fisher Sir Ronald Aylmer Fisher, byname R.A. Fisher (born February 17, 1890, London, England—died July 29, 1962, Adelaide, Australia), British statistician and geneticist who pioneered the application of statistical procedures to the design of scientific experiments. 在《 The MacTutor History of Mathematics archive 》 http://www-history.mcs.st-andrews.ac.uk/Biographies/Fisher.html Fisher z-transform 在《苏联数学百科全书》的当前网络版 词条“Correlation (in statistics)” http://www.encyclopediaofmath.org/index.php/Correlation_(in_statistics) If one usually uses the Fisher z-transform , with replaced byz according to the formula Even at relatively small values the distribution of is a good approximation to the normal distribution with mathematical expectation and variance . On this basis one can now define approximate confidence intervals for the true correlation coefficient . For the distribution of the sample correlation ratio and for tests of the linearity hypothesis for the regression, see . References H. Cramér, "Mathematical methods of statistics" , Princeton Univ. Press (1946) B.L. van der Waerden, "Mathematische Statistik" , Springer (1957) M.G. Kendall, A. Stuart, "The advanced theory of statistics" , 2. Inference andrelationship , Griffin (1979) S.A. Aivazyan, "Statistical research on dependence" , Moscow (1968) (In Russian) 相关链接: 《胜过 Fisher z 变换!(1)》 http://bbs.sciencenet.cn/home.php?mod=spaceuid=107667do=blogid=603297 《胜过 Fisher z 变换!(2)》 http://blog.sciencenet.cn/home.php?mod=spaceuid=107667do=blogid=657534
5801 次阅读|9 个评论
[转载]【好】肠道—系统解剖
chnfirst 2013-2-27 14:49
http://www.xctmr.com/anatomy/gross/2009-02-03/42.html 肠道—系统解剖(图文) 来源: 影像园 作者: hyc3140 【 复制分享 】【 讨论-纠错 】【 举报 】 一、小肠 xkS影像园XCTMR.com 小肠(small intestine)为消化管中最长的一段,也是消化吸收的主要场所。小肠盘曲在腹腔的中、下部,上接幽门,下续盲肠,成人全长约5~7m。分为十二指肠、空肠和回肠3部分。 xkS影像园XCTMR.com (一)十二指肠 xkS影像园XCTMR.com 十二指肠(duodenum)为小肠的首段,上接胃的幽门,下续空肠,长约25cm。除起始部和终端外,其余部分都紧贴腹后壁。十二指肠呈“C”字形从右侧包绕胰头,全长分为上部、降部、水平部和升部4部分。 xkS影像园XCTMR.com 1.上部(superior part) 又称球部,于第1腰椎的右侧起自幽门,行向右后方,至肝门下方,胆囊颈附近,急转向下续为降部,转折处称十二指肠上曲(superior duodenal flexure)。上部靠近幽门约2.5cm的一段肠管,肠壁较薄,粘膜多较平滑,称十二指肠壶腹又称十二指肠球(duodenal bulb)。 xkS影像园XCTMR.com 2.降部(descending part) 十二指肠上曲沿第1~3腰椎体的右侧下降,至第3腰椎水平,急转向左连接水平部,转折处称十二指肠下曲(inferior duodenal flexure)。降部的粘膜形成许多环形襞,在其后内侧壁上,有一纵行的粘膜皱襞,称十二指肠纵襞(longitudianl fold of duodenum)。纵襞的下端有一隆起,称十二指肠大乳头(major duodenal papilla),是胆总管和胰管共同开口之处。在大乳头上方1~2cm处有时可见有十二指肠小乳头,是副胰管的开口部位。 xkS影像园XCTMR.com 3.水平部(horizontal part) 自十二指肠下曲水平向左横行,越过下腔静脉、腹主动脉的前方,于第3腰椎的左侧移行为升部。 xkS影像园XCTMR.com 4.升部(ascending part) 自第3腰椎的左侧接水平部,斜向左前上方至第2腰椎体左侧,再向前下方弯曲续于空肠,此弯曲称十二指肠空肠曲。此曲被十二指肠悬肌固定于腹后壁。十二指肠悬肌和其表面的腹膜皱襞共同构成十二指肠悬韧带(suspensory ligament of duodenum),又称Treitz韧带,是确认空肠起始端的标志。 xkS影像园XCTMR.com xkS影像园XCTMR.com (二)空肠和回肠 xkS影像园XCTMR.com 空肠(jejunum)和回肠(ilium)借小肠系膜根连于腹后壁,上起自十二指肠空肠曲,下接盲肠,迂回盘曲成肠袢,位于腹腔的中、下部,周围有大肠环绕。通常空肠约占空、回肠全长的近侧2/5,位于腹腔的左上部;回肠占空、回肠全长的远侧3/5,位于腹腔的右下部。另外,约2﹪的成人在距离回肠末端0.3m~1m范围的回肠壁上,有长2~5cm的囊状突起,自肠壁向外突出,称Meckel憩室,其为胚胎期卵黄囊未完全退化形成的遗迹。 xkS影像园XCTMR.com xkS影像园XCTMR.com 二、大肠 xkS影像园XCTMR.com 大肠(large intestine)起始段在右髂窝处与回肠相接,末端终于肛门,长约1.5m,分为盲肠、结肠、直肠和肛管4部分。 xkS影像园XCTMR.com 盲肠和结肠在外形上有3个特征:结肠带(colic bands)是肠壁的纵行肌聚集而成的带状结构,共3条,起于兰尾根部,沿肠管的表面纵行排列,止于乙状结肠末端 ;结肠袋(haustra of colon)位于相邻两条结肠带之间,由肠壁呈袋状向外膨出而成,在X线平片上可借此区别大、小肠;肠脂垂(epiploicae appendices)附于结肠带的边缘,是脂肪组织及浆膜聚集成的大小不等形状各异的突起。上3种结构是肉眼区别结肠和小肠的重要依据。 http://www.xctmr.com/anatomy/gross/2009-02-03/42_2.html 肠道—系统解剖(图文) 来源: 影像园 作者: hyc3140 【 复制分享 】【 讨论-纠错 】【 举报 】 xkS影像园XCTMR.com xkS影像园XCTMR.com (一)盲肠 xkS影像园XCTMR.com 盲肠(cecum )位于右髂窝内,呈囊袋状,长6~8cm。盲肠上续结肠,左接回肠。回肠在盲肠的开口处,形成唇状皱襞,称回盲瓣(ileocecal valve)。此瓣可阻止小肠内容物过快流入大肠,又可防止盲肠内容物逆流到回肠。在盲肠后内侧壁上的蚓状盲管称阑尾(vermiform)。其末端游离,一般长6~8cm。末端的位置个体间变化较大,但根部的位置较恒定。 xkS影像园XCTMR.com 阑尾根部的体表投影,约在脐与右髂前上棘连线的中、外1/3交点处,此点称为麦氏点(Mc Burney),急性阑尾炎时,此处常有明显的压痛。 xkS影像园XCTMR.com xkS影像园XCTMR.com (二)结肠 xkS影像园XCTMR.com 结肠在右髂窝内起于盲肠,呈方框围绕在空、回肠的周围。结肠按部位分为升结肠、横结肠、降结肠和乙状结肠4部分。升结肠(ascending colon)是盲肠的直接延续,在右腹外侧区上升至肝右叶下方,弯向左前方移行于横结肠,弯曲部称结肠右曲(rightcolic flexure),又称肝曲。横结肠(transverse colon)向左行至左季肋区,在脾的下方,以锐角与降结肠相连,弯曲部称结肠左曲(left colic flexure),又称脾曲,其位置比结肠左曲要高,接近脾和胰尾,故左曲的位置较高较深。横结肠的活动度较大,常下垂成弓形,其最低点可达脐平面或脐下方。降结肠(descending colon)在左腹外侧区下降,至左髂嵴处续于乙状结肠。乙状结肠(sigmoid colon)呈乙字形弯曲,活动度较大,向下至第3骶椎平面,移行于直肠。 xkS影像园XCTMR.com (三)直肠 xkS影像园XCTMR.com 直肠(rectum)位于骨盆腔内,在第3骶椎水平接乙状结肠,向下沿第4~5骶椎和尾骨前面下降,穿过盆膈移行为肛管,全长约lO~14cm。直肠并非笔直,在矢状面上有两个弯曲:直肠骶曲(sacral flexure of rectum)凸向后,与骶、尾骨前面弯曲一致,距肛门约7~9cm;直肠会阴曲(perineal flexure of rectum)凸向前,距肛门约3~5cm,是直肠绕过尾骨尖形成的弯曲(图3-31)。临床上进行直肠、乙状结肠镜检时,应注意这些弯曲,以免损伤肠壁。 xkS影像园XCTMR.com xkS影像园XCTMR.com 直肠在外形上已失去大肠的外形特征。上端与乙状结肠交接处管径较细,直肠下部由于储存粪便而显著膨大,称直肠壶腹(ampulla of rectum)。直肠内面有3个直肠横襞,中间的直肠横襞位于直肠前右壁上,位置最恒定,距肛门约7cm。直肠横襞有承托粪便的作用。 xkS影像园XCTMR.com (四)肛管 xkS影像园XCTMR.com 肛管(anal canal)在盆膈平面与直肠相接,终止于会阴部的肛门(anus),长约4~5cm,为肛门括约肌所包绕。 http://www.xctmr.com/anatomy/gross/2009-02-03/42_3.html 肠道—系统解剖(图文) 来源: 影像园 作者: hyc3140 【 复制分享 】【 讨论-纠错 】【 举报 】 xkS影像园XCTMR.com 肛管粘膜形成6~10条纵行的粘膜皱襞,称肛柱(anal columns),相邻肛柱下端之间,彼此连有半月形的粘膜皱襞称肛瓣(anal valves)。肛瓣与肛柱下端共同围成的小隐窝称肛窦(anal sinuses),窦口向上,肛门腺开口于此,窦内往往积存粪屑,易于感染。肛柱下端与肛瓣边缘共同围成锯齿状环行线,环绕肠管内面,称齿状线(dentate line)。 xkS影像园XCTMR.com 齿状线以上的上皮为单层柱状上皮;齿状线以下的上皮为复层扁平上皮。齿状线上方由内脏神经分布,下方由躯体神经分布。齿状线也是直肠动脉供应、静脉和淋巴回流的分界线。在齿状线下方,由于肛门内括约肌紧缩,而形成一宽约lcm略微凸起的环形带,称肛梳(anal pecten)。肛梳下缘有一不甚明显的环形线,称白线(white line)。
个人分类: 科普,如健康医学等|0 个评论
[转载]实验室不该有的行为:有则改之无则加勉
pigpig 2013-2-22 11:31
实验室是一个公共场所,大家在一起难免会磕磕碰碰。一个不经意的举动,可能会给别人带来很大的麻烦。在一个集体中,有必要约束自己的行为,做到互相指正互相谅解。了解哪些行为是别人反感的,也有助于提高自身修养。看看 丁香通 站友眼中讨厌的行为有哪些吧。 dew488站友认为 1. 做为一个老板,不要买啥东西都要嫌太贵,现在的商家都那样的,一分钱一分货啊。买了不好的东西做不出实验来,你又骂我们笨,这些还不是因为你贪便宜啊? 2. 平时你叫我们在实验室要注意个人的安全防护,但你呢?进实验室就啥都不换就进来了(实验时都做病毒或细菌啊)。你就不怕自己的身体啊?你要倒了我们可不能毕业啊?虽然你是老板,但你也要给大家带好头啊? 3. 每次我们在做开题报告时,你能不能也多看点我们每个人的实验结果在说话,每次都是说:大家要多看外文资料。多看同性质的文章,但你啥都不了解,就等我们给你说,你作为老板,你也要给大家做领头的啊?方向性的还要你做主啊? 4. 不要在国外看见人家在做啥研究就要我们跟着瞎忙呼,人家能做出成就来那是人家做了很多前期工作了。我们空手起家,3年研究生生活靠一个人就能做出人家多年的工作?现实吗? sunfeisunfei 站友认为 1. 私藏实验公共材料,包括实验用盐水瓶、培养瓶、吸管等。导致实验器材缺乏,而实际上大量的器材被私藏而没有被使用。 2. 频繁无计划的开冰箱,并且冰箱门大开进行某些操作。导致冰箱温度的不稳定,影响了其他的放置物品的冻存效果。乱翻其中放置的物品,使后来人要费很大的劲才能找到自己的物品。 3. 打开细胞培养箱门的幅度过大,过频,不及时关闭,导致培养箱温度及二氧化碳浓度降低。未经他人同意,而私自观察他人培养的细胞。有时候,细胞正需要绝对的静止,而他人的私自查看,可能就影响了细胞的贴壁。 4. 未经他人同意,使用他人实验物品。结果导致他人使用时候,才发现没有了该物品。 5. 他人消毒后的物品,没有在超净台中而私自打开。后不告知而又重新包装上。 6. 穿在手上,并且粘有有毒物质(如EB、PMSF等物质)的手套乱摸,包括门把手、键盘等。导致他人裸手而间接粘上此类有毒物质。 7. 使用完毕离心机、显微镜等,不关机就离开。 8. 粘有有毒物质的瓶子不给予特殊处理,而同其他的瓶子放到一起。 9. 在公用试剂的标签上乱写,标明自己的剂量,而影响后人的使用。 10. 最重要的一条:在公共实验中,没有协作合作精神,缺乏责任感。 lalala_2004站友认为 1. 实验完成后不及时清理现场,总留给别人一个烂摊子。 2. 长时间占用实验室公用电脑,上网聊天游戏,妨碍他人查资料。 3. 公用仪器不爱惜,损坏后隐瞒不报,推卸责任。 4. 作实验不作好记录,不及时总结实验数据。 5. 没有做过的实验,不请教别人,自己盲目动手,浪费材料,甚至造成危险后果。 lalala_2004 站友认为 1. 明确责任者,每一种固定资产都有责任者。并在明确的地方贴上责任者的名字,方便有问题时联系责任者。 2. 制定每种仪器的使用方法。由责任者制定使用方法及注意事项等等,贴在仪器上。 3. 仪器使用预定制,制作表格放在仪器(PCR仪,水浴,摇床,电脑等等)旁边。使用前需要预定,使用后标明完成。 4. 实验室的玻璃仪器,试药等等都分类都专人负责,需要时向专人领取并登记。用完后归还并登记。 5. 经常使用的试剂如TB,SOC等等以及常用的胶,平板等等作为公共活,大家轮流做。 6. 每一级别对下级进行监督,并在考核中进行考虑。 wgqsdams站友认为 1. 高压完的枪头或别的东西不及时地收回,以致于储物葙里都没有空余的地方放刚刚烘干的高压完的物品,后来发现了,一看过期了,又重新高压; 2. 可回收的和不可回收的物品不分门别类的放,以致于有些可回收的物品被当垃圾一样扔了,造成了很大的浪费; 3. 一些公用试剂、物品或仪器不按规程操作,给后用者造成很大的损失(试剂、物品污染或仪器校对不准等); 4. 最主要的是一些实验操作规范的问题,像试剂的节约、仪器的爱护、有荧光的表记物避光、提RNA的注意事项等等,轻者是自己的实验出问题,重者是影响到实验室的风气问题。 关于如何解决,我觉得实验室也需要建立一套严格的、专人负责的规章制度,不过,制度毕竟只是起一个监督的作用,更多的还是的需要我们在实验室的人员以身作则、身体力行,努力创造一个相互协作的、有良好气氛的实验环境。 十二个月站友认为 1. 不注重进入实验区的穿戴:拖鞋上下阵,有时不穿白大褂,赤手取物品; 2. 实验时干与实验无关的事情:大声喧哗,唱歌,起哄,闲聊,等待时间打电脑游戏; 3. 卫生意识差:实验室里吃东西,包子、桃子、西瓜,五花八门,只要逮着什么,吃什么,稍用水冲冲手就拿着啃了,甚至不洗手直接在白大褂上擦几下就算了事(晕!)。 4. 试剂摆放不规则,仪器使用不做正常维护。各种试剂一股脑儿全推在一起,找的时候干着急;仪器用时不登记,用后不清洗,残留在管子里、表面上的污痕,结果越来越脏,让人看了恶心。 whitesnail站友认为 1. 个人感觉最明显的:进出门不敲门、将门摔得很响,不关门; 2. 当天实验结束后将剩余的动物养在实验室而不放回动物房,第二天实验室气味很不好; 3. 本人以前喜欢将实验剩余的液体放在冰箱里备用,但是用到的机会不到1%,过段时间一看,很多残液,占空间; 4. 实验数据不及时拷走,占实验电脑的空间,运行也慢; 5. 借用别人物品不放回原处,最可怕的是自己也忘了放哪; 6. 做过实验的器皿不及时清洗,能泡多久就泡多久,暑假期间有位同学的盆中蚊虫产卵,很是触目惊心; 7. 试剂标签掉了,不及时贴回,只是在瓶子上面做个简单的标记,想着等会贴,但是一忙起来就忘了,时间长了,等自己也忘了那些XX,∨∨代表什么东西,这瓶试剂就报废了。 fengrujie站友认为 1. 实验台面用过后不打扫 2. 将固状物连同液体一起倒在水槽 3. 生活垃圾和实验垃圾不分类 4. 某些实验仪器用完后不复原,如让pcr仪长期保持4度不关机,低温离心机长久打开顶盖等 发生的原因,归结为几点,有的是实验人员没有责任心,有的是新手刚来不懂操作规程,有的是不小心遗忘。 (function(w, d, g, J) { var e = J.stringify || J.encode; d = d || {}; d = d || function() { w.postMessage(e({'msg': {'g': g, 'm':'s'}}), location.href); } })(window, document, '__huaban', JSON);
2613 次阅读|0 个评论
[转载]Velest
zhanggw 2013-2-21 10:27
Velest是个1D模型反演程序,在编译过程中出现这样的错误: /tmp/cchX84r1.o: In function `cputimer_': velest.f:(.text+0x2c64d): undefined reference to `clock_' /tmp/cchX84r1.o: In function `datetime_': velest.f:(.text+0x2c6ae): undefined reference to `sprintf_' collect2: ld returned 1 exit status 需要修改下子函数: 将subroutine CPUTIMER(cpusec) 和 subroutine DATETIME(dattim) 修改为: subroutine CPUTIMER(cpusec) ! Urs Kradolfer, 16.9.91 implicit none real cpusec, icpu call cpu_time(icpu) cpusec=icpu end ! of subroutine cputimer subroutine DATETIME(dattim) ! Urs Kradolfer, 16.9.91 implicit none character datum*26, dattim*20 character ctime integer(KIND=2) it external ctime !$pragma C(ctime) it=time8() datum=ctime(it) dattim=datum(5:24) end ! of subroutine datetime 编译过程中遇到:FORTRANerror:relocationtruncatedtofit:R_X86_64_32S f77 -o velest velest.f修改为 f77 -o velest -mcmodel=medium velest.f 即可解决。 部分转载别人,附上相关网址: g77 time8 http://gcc.gnu.org/onlinedocs/gcc-3.3.6/g77/Time8-Intrinsic.html#Time8-Intrinsic gfortran cpu_time http://www.cse.yorku.ca/tdb/_doc.php/userg/man_g/file/gfortran/node/CPU_TIME gfortran ctime http://gcc.gnu.org/onlinedocs/gfortran/CTIME.html VELEST http://www.orfeus-eu.org/Software/softwarelib.html ftp://www.orfeus-eu.org/pub/software/mirror/thurber/VELEST/ 参考处: http://nota.tw/index.php/2011/04/21/adjust-velest-in-ubuntu/
个人分类: PROGRAMS|4541 次阅读|0 个评论
[转载]时间序列-结构函数(IDL程序)
deliangwang 2013-2-4 13:22
PRO sf,time,rate,lag,sf,evenly=evenly $ ,delta=delta,logdelta=logdelta,lagsample=lagsample $ ,mincouples=mincouples ;+ ; NAME: ; sf ; ; PURPOSE: ; Compute the structure function of a lightcurve, according to the ; definitions given by Nandikotkur et al., 1997, AIP ; Conf. Proc 410, 1361P for the evenly case and Paltani et ; al., 1997 AA 327, 539P for the unevenly case. ; ; CATEGORY: ; time series analysis ; ; ; CALLING SEQUENCE: ; sf,time,rate,lag,sf ; ; INPUTS: ; time : The times at which the time series was measured ; rate : the corresponding count rates ; ; ; OPTIONAL INPUTS: ; none ; ; ; KEYWORD PARAMETERS: ; delta : width for the lag rebining in the unevenly case ; (if not set, is equal to 1e-6) ; logdelta : delta in logaritmic expression ; evenly : if set, compute the estimation of the structure ; function for evenly sample data, otherwise ; compute the estimation for unevenly sample data ; lagsample : sample of time lags, if not set, all possible ; lags in the time sample are take as lag sample. ; mincouples: minimum number of couples in a bin of the ; structure function not to be ignored, if not set, ; is equal to 1. ; ; OUTPUTS: ; sf : the "structure function"-values to each time lag ; lag : sample of time lags ; ; OPTIONAL OUTPUTS: ; none ; ; ; COMMON BLOCKS: ; none ; ; ; SIDE EFFECTS: ; none ; ; ; RESTRICTIONS: ; none ; ; ; PROCEDURE: ; none ; ; EXAMPLE: ; sf,time,rate,lag,sf,delta=2. ; ; ; MODIFICATION HISTORY: ; Version 1.0, 1998.12.21, Sara Benlloch (IAAT) ; Version 1.1, 1999.01.07, lag sample in the unevenly case modificied. ; ( benlloch@astro.uni-tuebingen.de ) ; Version 1.2, 1999.01.26, new keywords; logdelta, lagsample, ; mincoupples. ;- ;; ;; lightcurve (lc) parameters ;; ;; number of points in the time series npt = n_elements(time) ;; subtract mean from data rat = rate-mean(rate) ;; ;; Structure Function ;; IF (keyword_set(evenly)) THEN BEGIN ;; for evenly-sampled discrete time series (ti=i*bint; xi) bt = (time(npt-1)-time(0))/(npt-1) ;; Estimation of the structure function: ;; sf(lag) = 1/npt(tau)SUM_{i=0,...npt-1-lag}(x(i+lag)-x(i))^2 ;; the average been taken over all measurements separated by ;; the respective lag and npt(lag) being the number of such ;; pairs ( Nandikotkur et al., 1997, AIP Conf. Proc 410, 1361P) sf = dblarr(2,npt-1) FOR lag=1L,npt-1 DO BEGIN ; ( lag = 1,...,npt-1 ) sf = total((rat -rat )^2)/(npt-lag) sf = npt-lag END ;; Lag sample lag = bt*findgen(npt-1)+bt ENDIF ELSE BEGIN ;; for unevenly time series (ti,xi),i=1,...npt with arbritary ti ;; Estimation of the structure function: ;; sf(lag,delta)=(1/npt(lag,bin))SUM_{(i,j)/R} ^2 ;; such that npt(lag,delta) is the number of couples ;; that satisfy the relationship ;; R := ( lag-delta/2 tj-ti lag+delta/2 ) ;; ( Paltani et al., 1997 AA 327, 539P ) ;; logarithmic R := | log(|tj-ti|)-log(lag) | = delta ;; time and rate couples : tj-ti and xj-xi for all ji t_couple = time-shift(time,1) r_couple = rat-shift(rat,1) time_couples = t_couple(1:npt-1) rate_couples = r_couple(1:npt-1) FOR i=2L,npt-1 DO BEGIN t_couple = time-shift(time,i) r_couple = rat-shift(rat,i) time_couples = rate_couples = ENDFOR ;; lag sample IF keyword_set(lagsample) THEN BEGIN lag = lagsample ENDIF ELSE BEGIN lag = time_couples(sort(time_couples)) lag = lag(uniq(lag,sort(lag))) ENDELSE ;; width for the lag rebining IF (n_elements(delta) EQ 0) THEN delta=1e-6 ;; structur function estimate sf = dblarr(2,n_elements(lag)) FOR t=0L,n_elements(lag)-1 DO BEGIN IF keyword_set(logdelta) THEN BEGIN rel = abs( alog10(time_couples) - alog10(lag(t)) ) relationship = where( rel LE logdelta , count ) ENDIF ELSE BEGIN relationship = where( (time_couples LT lag(t)+delta/2.) $ AND (time_couples GT lag(t)-delta/2.), count) ENDELSE IF (count NE 0) THEN BEGIN sum = 0. sum_couples = rate_couples(relationship) FOR h=0L,count-1 DO BEGIN sum = sum + sum_couples(h)^2. sf(1,t) = (1./count)*sum ENDFOR ENDIF ELSE BEGIN sf(1,t)=0. ENDELSE sf(0,t) = count ENDFOR result = where( sf(1,*) NE 0. , count ) IF count NE 0 THEN BEGIN lag = lag(result) sf = sf(*,result) ENDIF IF keyword_set(mincouples) THEN BEGIN result = where( sf(0,*) GE mincouples , count ) IF count NE 0 THEN BEGIN lag = lag(result) sf = sf(*,result) ENDIF ENDIF ENDELSE return END
个人分类: 编程笔记|2374 次阅读|0 个评论
[转载]时间序列-自相关函数(IDL程序)
deliangwang 2013-2-4 13:15
PRO acf,time,rate,lag,acf,covf=covf ;+ ; NAME: ; acf ; ; PURPOSE: ; Compute the autocorrelation function of an evenly sample lightcurve ; ; ; CATEGORY: ; time series analysis ; ; ; CALLING SEQUENCE: ; acf,time,rate,lag,acf,covf ; ; ; INPUTS: ; time : the times at which the time series was measured ; rate : the corresponding count rates ; ; ; OPTIONAL INPUTS: ; none ; ; ; KEYWORD PARAMETERS: ; none ; ; ; OUTPUTS: ; lag : sample time lags ; acf : autocorrelation values to each time lag given in ; a two-dimensional array, once without ; correction-factor and once with. ; ; OPTIONAL OUTPUTS: ; covf : autocovariance values to each time lag given in ; a one-dimensional array. ; ; COMMON BLOCKS: ; none ; ; ; SIDE EFFECTS: ; none ; ; ; RESTRICTIONS: ; evenly time series ; ; ; PROCEDURE: ; The autocorrelation function is computed according to the ; approximation of evenly sample given by ; covf(lag)=(1/(npt-lag))SUM_{j=1,..npt-lag} ; acf(lag)=covf(lag)/covf(0) ; Additionally, a corection-factor given by Sutherland et ; al. 1978, Ajp 219, 1029P, is added. ; ; EXAMPLE: ; acf,time,rate,lag,acf,covf=covf ; ; ; MODIFICATION HISTORY: ; Version 1.0, 1998.12.21, Sara Belloch IAAT, Joern Wilms IAAT. ; ( benlloch@astro.uni-tuebingen.de ) ;- ;; ;; lightcurve (lc) parameters ;; ;; dimension of lc in bins npt = n_elements(time) ;; Autocorrelation is defined for series with mean zero rat = rate-mean(rate) ;; ;; Autocovariance function estimate by ;; covf(lag)=(1/(npt-lag))SUM_{j=1,..npt-lag} ;; covf = dblarr(npt) FOR lag=0,npt-1 DO BEGIN ; ( lag = 0,...,npt-1 ) covf = total(rat *rat ) / (npt-lag) END lag = (time -time ) * findgen(npt) ;; ;; Autocorrelation function ;; acf(lag)=covf(lag)/covf(0) ;; acf = dblarr(2,npt) acf(0,*) = covf / covf(0) ;; ;; correction-factors (Sutherland et al. 1978, ApJ 219, 1029P) ;; k1 = 1. / npt k2 = 1. / (npt*npt) FOR i=0,npt-1 DO BEGIN acf(1,i) = acf(0,i) + k1 - float(i)*k2 ENDFOR END
个人分类: 编程笔记|3071 次阅读|0 个评论
Facebook向每个用户支付10美元?
热度 2 pkuzeal 2013-1-29 22:00
Facebook 向每个用户支付 10 美元? 如果有有 Facebook 帐户,你也许在上周五收到一封奇怪的来信,信中说到你也许会因为一桩诉讼而获得收入 - 这不是恶作剧, Facebook 真的会付,你最多可能获得 10 美元。如何获取这笔收入呢?此处作一说明: 为什么我会成为 Facebook 的集体诉讼的受益者? 这个社交网络其实在未获得你许可的情况下把你作为了产品义务推销员。 举个例子,如果你喜欢 JustinBieber 的页面,你的 Facebook 粉丝将会收到一条这样的信息: Jeff 喜欢 Beeb 的新眼线。目前 Facebook 仍旧可以这样做, 因为其隐私条款已经作了修改,这是最早的陷阱广告。 我如何收取这笔收入? 五月二日前访问“结算”页面填写索取表格 我能得到多少 根据此前第二次的调解协议(第一次调解协议被法官驳回) Facebook 总计将付出两千万美元来了解此事。每个帐户可以获得最多 10 美元。 但这两千万并都会支付给 Facebook 用户的。 律师要收取近八百万美元,还有“第三方代理”以及“结算管理”也要分一杯羹。因此最终到用户手中约有一千万至一千二百万美元。 如果最终数字是一千二百万美元,那将有足够资金支付给一百二百万 Facebook 用户。 那如果有超过一百二十万用户索取这笔费用呢? 那只能分享了。如果 2 百万人索取,每人只有约 5 美元了。 有多少概率获得这笔钱呢? Facebook 在北美地区有一亿六千五百万用户,如果有 2% 用户决定提出申请,那你的机会就小了。 这看起来不太公平,到底谁能得到钱呢? 集体诉讼称向每人支付 4.99 美元是非常低效率的一件事。因此如果有太多的申请用户的话,这笔钱将支付给你在哈佛、斯坦福、巴克莱等朋友,这些机构以此来保护你的隐私。 我的隐私被侵犯了,而我拿不到钱? 而这样的故事在不断地发生着。 Google , Facebook 侵犯了大家的隐私,而赔偿款支付了律师费后又做了慈善。 但事实上,这并不象听起来那么疯狂。许多“被侵犯的隐私“并不太糟糕。 如果问一个问题,你愿意为没有广告的,纯净的 Facebook 每月支付 5 美元吗? 汉式婚礼 (function () { var last_mouse_move_point; var is_not_move; var script_id = 'maxthon-gestures-extention-helper'; var is_message_sended; // Whether the mouse is moved between 2 adjacent mousemove events function notMove(point) { if (is_not_move == false) { return false; } if (Math.abs(last_mouse_move_point.y - point.y) 2 && Math.abs(last_mouse_move_point.x - point.x) 2) { return true; } else { is_not_move = false; return false; } } if (window === top) { document.querySelector('#' + script_id).setAttribute('istopwindow', 'true'); } else { document.querySelector('#' + script_id).setAttribute('istopwindow', 'false'); document.addEventListener('mousedown', function (event) { if (event.button !== 2) { return; } is_not_move = true; last_mouse_move_point = null; is_message_sended = false; }, false); document.addEventListener('mousemove', function (event) { var point; if (is_message_sended) { return; } if (event.button !== 2) { // not right key is pressed down return; } point = { 'x': event.clientX, 'y': event.clientY }; if (last_mouse_move_point == null) { last_mouse_move_point = point; return; } if (notMove(point)) { return; } top.postMessage({ 'action': 'maxthon-gestures-start-drawing' }, '*'); is_message_sended = true; } ,false); } })();
164 次阅读|2 个评论
[转载]FORTRAN EVESF function
Irasater 2013-1-21 17:37
http://www.roguewave.com/Portals/0/products/imsl-numerical-libraries/fortran-library/docs/6.0/math/default.htm?turl=evesf.htm EVESF(输出的结果为本征值的绝对值按照从大到小的顺序) Computes the largest or smallest eigenvalues and the corresponding eigenvectors of a real symmetric matrix. Required Arguments NEVEC — Number of eigenvalues to be computed. (Input) A — Real symmetric matrix of order N . (Input) SMALL — Logical variable. (Input) If . TRUE ., the smallest NEVEC eigenvalues are computed. If . FALSE ., the largest NEVEC eigenvalues are computed. EVAL — Real vector of length NEVEC containing the eigenvalues of A in decreasing order of magnitude. (Output) EVEC — Real matrix of dimension N by NEVEC . (Output) The J -th eigenvector, corresponding to EVAL ( J ), is stored in the J -th column. Each vector is normalized to have Euclidean length equal to the value one. Optional Arguments N — Order of the matrix A . (Input) Default: N = SIZE ( A ,2). LDA — Leading dimension of A exactly as specified in the dimension statement in the calling program. (Input) Default: LDA = SIZE ( A ,1). LDEVEC — Leading dimension of EVEC exactly as specified in the dimension statement in the calling program. (Input) Default: LDEVEC = SIZE ( EVEC ,1). FORTRAN 90 Interface Generic: CALL EVESF (NEVEC , A , SMALL , EVAL , EVEC ) Specific: The specific interface names are S_ EVESF and D_ EVESF . FORTRAN 77 Interface Single: CALL EVESF (N , NEVEC , A , LDA , SMALL , EVAL , EVEC , LDEVEC) Double: The double precision name is DEVESF . Description Routine EVESF computes the largest or smallest eigenvalues and the corresponding eigenvectors of a real symmetric matrix. Orthogonal similarity transformations are used to reduce the matrix to an equivalent symmetric tridiagonal matrix. Then, an implicit rational QR algorithm is used to compute the eigenvalues of this tridiagonal matrix. Inverse iteration is used to compute the eigenvectors of the tridiagonal matrix. This is followed by orthogonalization of these vectors. The eigenvectors of the original matrix are computed by back transforming those of the tridiagonal matrix. The reduction routine is based on the EISPACK routine TRED2 . See Smith et al. (1976). The rational QR algorithm is called the PWK algorithm. It is given in Parlett (1980, page 169). The inverse iteration and orthogonalization computation is discussed in Hanson et al. (1990). The back transformation routine is based on the EISPACK routine TRBAK1 . Comments 1. Workspace may be explicitly provided, if desired, by use of E5ESF/DE5ESF . The reference is: CALL E5ESF (N, NEVEC, A, LDA, SMALL, EVAL, EVEC, LDEVEC, WK, IWK) The additional arguments are as follows: WK — Work array of length 9 N . IWK — Integer array of length N . 2. Informational errors Type Code 3 1 The iteration for an eigenvalue failed to converge. The best estimate will be returned. 3 2 Inverse iteration did not converge. Eigenvector is not correct for the specified eigenvalue. 3 3 The eigenvectors have lost orthogonality. Example In this example, a DATA statement is used to set A to a matrix given by Gregory and Karney (1969, page 55). The largest two eigenvalues and their eigenvectors are computed and printed. The performance index is also computed and printed. This serves as a check on the computations. For more details, see IMSL routine EPISF . USE EVESF_INT USE EPISF_INT USE UMACH_INT USE WRRRN_INT IMPLICIT NONE ! Declare variables INTEGER LDA, LDEVEC, N PARAMETER (N=4, LDA=N, LDEVEC=N) ! INTEGER NEVEC, NOUT REAL A(LDA,N), EVAL(N), EVEC(LDEVEC,N), PI LOGICAL SMALL ! ! Set values of A ! ! A = ( 5.0 4.0 1.0 1.0) ! ( 4.0 5.0 1.0 1.0) ! ( 1.0 1.0 4.0 2.0) ! ( 1.0 1.0 2.0 4.0) ! DATA A/5.0, 4.0, 1.0, 1.0, 4.0, 5.0, 1.0, 1.0, 1.0, 1.0, 4.0, 2.0, 1.0, 1.0, 2.0, 4.0/ ! ! Find eigenvalues and vectors of A NEVEC = 2 SMALL = .FALSE. CALL EVESF (NEVEC, A, SMALL, EVAL, EVEC) ! Compute performance index PI = EPISF(NEVEC,A,EVAL,EVEC) ! Print results CALL UMACH (2, NOUT) CALL WRRRN ('EVAL', EVAL, 1, NEVEC, 1) CALL WRRRN ('EVEC', EVEC, N, NEVEC, LDEVEC) WRITE (NOUT,'(/,A,F6.3)') ' Performance index = ', PI END Output EVAL 1 2 10.00 5.00 EVEC 1 2 1 0.6325 -0.3162 2 0.6325 -0.3162 3 0.3162 0.6325 4 0.3162 0.6325 Performance index = 0.031
个人分类: Software|2846 次阅读|0 个评论
[转载]choose your career
twhlw 2012-12-8 13:10
破解你的“百万富翁密码” 你 完全有能力赚到更多的钱,你也一定能过上更快乐、更健康、更轻松的生活。怎样才能实现呢?那就是改行。 在《百万富翁的思维》(The Millionaire Mind)一书中,斯坦利(Thomas Stanley)写道:“拥有高度创造性智慧的百万富翁通常能正确地做出一个十分重要的职业生涯决策:他们会选择一个能赚到很多钱的职业,而这个职业通常又是他们所热爱的。请记住,如果你热爱自己所做的工作,你的生产效率就会很高,你的特殊创造天赋也会显现出来。” 斯坦利也从反面论述了这一观点:“正如大多数百万富翁所述,若将许多努力投入与个人能力不匹配的工作中,其直接结果便是压力。如果从事与你的资质不吻合的职业,无论是心理还是生理上都会感觉更困难、更吃力。” 以下是你要走的第一步,做一做笔者所着《百万富翁密码》(Millionaire Code)一书中的小测试。该测试是根据荣格(Carl Jung)的性格类型和迈尔斯-布里格斯(Myers-Briggs)的16种性格类型设计而成的。 请做一下这个由四部分组成的简单测试,找到你的四字母“百万富翁密码”。之后,你可以按图索骥,查看迈尔斯-布里格斯的16种性格类型,探索与适合你的新职业选择相关的一些具体信息。 这项测试看起来可能和你多年前做过的某个测试差不多。但情况会发生变化,所以请以开放的态度接受你身上发生的巨大变化。你不会是第一个离开银行,去做艺术家、珠宝设计师或记者的金融从业者,但你也许会成为最快乐的那一个。 这项测试非常简单,没有艰涩的心理学术语。请凭直觉依次从以下四对字母中挑选出一个与你的情况(而不是工作、社交场合中其他人,甚至家人对你的期望)最为吻合的字母。你将会认识到真正的自己是什么样的: 1. 外向型还是内向型?(E或I) 如果可以选择,你更希望生活在什么样的世界里呢?我们都希望二者兼有,但外向型的人更喜欢沟通、社交,与人聊天和倾听。内向型的人则更喜欢他们自己的内心世界──较之与现实世界打交道,他们更爱独处、阅读、安静地思考,在自己的内心世界里生活和解决问题。 2. 感觉型还是直觉型?(S或N) 你是如何运用信息的?我们都用视觉、听觉、触觉、味觉和嗅觉这五感来获得具体数据。然而,感觉型的人随后会将新数据与过去的信息进行对比。而直觉型的人则以未来为导向,他们从原始数据中看出意义、可能性,并加以概括。感觉型的人更依赖数据。直觉型的人则更依赖预感、概念和灵感。 3. 思维型还是情感型?(T或F) 你是如何做决定的?思维型的人希望做正确、公平、公正的事情。他们往往比较客观公正,运用逻辑、理性思维和推理。而情感型的人则比较主观和个人化,他们做决定的依据是个人价值和换位思考,是为了让自己和他人在工作、家庭和世界中感到愉快。 4. 判断型还是感知型?(J或P) 你更喜欢什么样的日常生活方式?判断型的人喜欢井然有序、有组织的生活方式,要有日程安排、计划、待办事项、清单、须完成任务以及特定目标。感知型的人则重视顺其自然和灵活的目标,能够轻松地适应新的局面。他们更喜欢在变化的环境中保持选择方案的灵活性(通常会保持到最后时刻)。 你与真实的自我合拍吗?你是否在给自己制造压力,为你的命运、你生命的意义蒙上阴影?如欲进一步了解:请看一看16种性格类型,读一读与你的四字母密码相对应的描述。比方说,我是INFP型,是一个寻找生活意义,寻求让世界变得更美好的理想主义者。 你的四字母“百万富翁密码”是什么?你可以从迈尔斯-布里格斯16种性格类型中找到与你的特定性格相关的具体信息。让我们先从与16种性格相关的大类说起,这其中包括你的性格类型。 系统策划者(ENTJ、ENTP、INTJ或INTP) 这里面没有羞怯的人。你是聪明、精力充沛的开拓者,热爱智力挑战,会为完善程序、系统等而夜以继日地工作。你为实现梦想、改变世界而奋斗,因此你的决策依据是实现所有人整体利益的最大化(而不是任何特定的个人),你会在情感和坚守的底线之间取得平衡。你往往是人群中的首领。 职业路径:像你这样的领导者遍及各行各业。担任公司高管、银行经理或办公室经理、筹款人、医院管理者或销售经理可能会让你这样的精英感到愉快。 守成者(ESTJ、ESFJ、ISTJ或ISFJ) 你是美国企业界的中流砥柱,你更关注现在而非过去,但着眼于未来。你爱做计划,会定期投资401(k)中最保守的项目以及你所在工会的养老基金,此外,你很可能会为孩子投资大学学费储蓄计划。你偏好安全、保险和秩序。 职业路径:让你感觉最愉快的是有清晰规定、结构森严的大型组织环境;也可以是警务机构或军队。公司里任何职位你都适合,你可以担任主管、经理、高管、技术专家或员工顾问。 独立创造者(ESTP、ESFP、ISTP或ISFP) 你更喜欢为自己工作,而不是为雇主工作,你也爱帮助和取悦他人。 你不介意变通一些规则,也不介意做一个独立工作的人。压力、意外和自由让你的生活变得完整! 职业路径:运用你的创业精神来启动自己的事业,哪怕只是兼职也好。你也许可以从经纪公司入手,因为在经纪公司你可以自行控制工作量和工作时间。 有富余的时间和金钱?你可以通过加盟Mrs. Fields或塔可钟(Taco Bell)这样的特许经营店进行投资理财。也可考虑从事一些抽取佣金,自己给自己做老板的职业,比如房地产经纪人、作家、广告经理、旅游代理人和销售职位。 开路者(ENFJ、ENFP、INFJ或INFP) 你愿意帮助弱者,对人抱有同情心,这使你成为了所有人的激励者。你对工作、生活和其他人的潜能抱有理想和激情。你是为启发、鼓励和激励他人而生的。你拥有很强的心灵直觉,在阅读肢体语言和捕捉他人感受方面拥有出色的直感和能力。 职业路径:社会工作、教学、公共关系、职业生涯和指导顾问以及人力资源专员等职业的性质都适合那些关爱和同情他人、需要与人交往和本能地渴望创造和谐与和睦氛围的人。 如欲了解更多:请看看笔者的《百万富翁密码》一书,了解有关16种性格类型的详细信息。你可以找到自己的性格类型。一定要读读斯坦利的《百万富翁的思维》以及白金汉(Marcus Buckingham)的书,建议先从《你需要知道的一件事》(The One Thing You Need to Know)开始读:“确定什么事情是你不喜欢做的,然后停掉它。”接下来,请研读白金汉有关“优势测评”的书,找到你爱做的事情并专注地去做。 保持耐心。到时候你自然会知道该做什么。我在摩根士丹利(Morgan Stanley)投资银行部门工作的许多年里,一直在电视艺术与科学学院(Television Academy)和演员工作室(Actors Studio)等地方参加写作、导演和表演研习班,我制作的一个电影短片获得了一项金奖。 然后有一天,我突然意识到行动的时机已到。离开投资银行业不久之后,我成为了一名报纸编辑,随后在金融新闻网(Financial News Network)担任高管,之后又做了财经记者。这是我做过的最佳决策。保持耐心,做好准备,你会意识到什么时候是合适的时机,你会知道的。 不论你做什么,都不要在奇迹发生前五分钟放弃你的梦想。请牢记斯坦利在《百万富翁的思维》一书中所说的话:“如果你热爱自己所做的工作,你的生产效率就会很高,你的特殊创造天赋也会显现出来。” 再推荐两本必读书:布里奇斯(Bill Bridges)的《转变》(Transitions)和西内塔(Marsha Sinetar)的《做你爱做的事,财富自然会来》(Do What You Love, The Money Will Follow)。 Paul B. Farrell
1360 次阅读|0 个评论
Vasp5.2编译undefined reference to `cheevx_' 出错解决办法
zbb1223 2012-11-20 22:38
错误提示: n_lhf.o twoelectron4o.o ratpol.o screened_2e.o wave_cacher.o chi_base.o wpot.o local_field.o ump2.o bse_te.o bse.o acfdt.o chi.o sydmat.o dmft.o rmm-diis_mlr.o linear_response_NMR.o fft3dfurth.o fft3dlib.o -L../vasp.5.lib -ldmy ../vasp.5.lib/linpack_double.o ../vasp.5.lib/lapack_double.o /usr/lib/libgoto.so bse.o: In function `bse_mp_diag_bse_matrix_': bse.f90:(.text+0xa466): undefined reference to `cheevx_' make: *** Error 1 原因: vasp调用GotoBLAS库libgoto2.so时出错,因为GotoBLAS库安装时,需要下载lapack软件包,但是由于网络问题,没有安装成功。 解决办法: 下载lapack-3.1.1.tgz文件,copy到GotoBLAS目录下,重新编译GotoBLAS就可以了
5956 次阅读|0 个评论
难以置信的结果
热度 1 xiasw 2012-11-19 16:28
try-function(i,j){ t-seq(1:i*j) return(t)
2768 次阅读|2 个评论
EOF analysis of one climate field
热度 2 gwangcc 2012-11-1 17:09
function =eof(X,neof) % function =eof_analysis(X,neof) % Wrapper function to perform PCA of a field X % with TWO spatial dimensions. (This code will also % work with a SINGLE spatial dimension. But it might % be easier to directly call 'principal_component_analysis'.) % This function basically transforms the data matrix into % a standard 2-d data matrix, taking into account NaNs. % Input: % X: (x,y,t) or (x,t). % neof: number of EOF/PC to return % Output: % EOFs: 3-d (x,y,e) or 2-d (x,e) matrix with spatial % patterns. % PCs: 2-d matrix (t,e) with principal components (scores) % in the columns % Var: variance of each principal component % Xrecon: 3-d (x,y,t) or 2-d (x,t) matrix with reconstructed X % WITHOUT adding back the mean % Note: Xpc is the projection of X onto the corresponding EOF. % That is, Xpc(it,ie) = nsum(nsum(X(:,:,it).*Xeofs(:,:,ie))) % Use this to project a physical field onto EOF space. % If X only has 2 dimensions, assume second dimension is time. % Insert 'y' dimension to conform with rest of function which % assumes X represents multiple realizations of a 2-D field. if ndims(X)==2 =size(X); X=reshape(X, ); end % Flatten 2-d fields into single vector =size(X); Xd=reshape(X, ); % (space,time) % remove NaNs inn=find(~isnan(Xd(:,1))); Xd=Xd(inn,:); % (space, time) n=size(Xd,1); %normalize for i=1:n % Xd(i,:)=Xd(i,:)-nanmean(Xd(i,:)); % Xd(i,:)=detrend(squeeze(Xd(i,:)),'constant'); % Xd(i,:)=detrend(squeeze(Xd(i,:))); Xd(i,:)=zscore(detrend(squeeze(Xd(i,:)),'constant')); end Xd=Xd'; Xd=double(Xd); % PCA if nargout3 =principal_component_analysis(Xd,neof); else =principal_component_analysis(Xd,neof); end % Xpcs (t,e) % Reshape EOFs to physical space Xeofs=repmat(NaN, ); Xeofs(inn,:)=EOFs; Xeofs=squeeze(reshape(Xeofs, )); Xrecon=repmat(NaN, ); for ie=1:neof for it=1:nt Xrecon(:,:,it)=Xrecon(:,:,it)+Xpcs(it,ie)*Xeofs(:,:,ie); end end if nargout3 XR=XR'; % (x,t) Xrecon=repmat(NaN, ); Xrecon(inn,:)=XR; Xrecon=squeeze(reshape(Xrecon, )); end function Xpcs=eof_project(Xanom,Xeofs,numd) % function Xpcs=eof_analysis(Xanom,Xeofs,numd) % Function to project physical field (1 or 2 spatial % dimensions) onto EOF. % Input: % Xanom: (x,y,t) or (x,t) - physical ANOMALY field % Xeofs: 3-d (x,y,e) or 2-d (x,e) matrix with spatial % patterns. % numd: if Xanom is (x,t), MUST set ndims=1 % Output: % Xpcs: 2-d matrix (t,e) with projection coefficients % (principal components) in the columns. Number % of projection coefficients returned is equal % to the number of EOFs passed in the input argument. % Samar Khatiwala (spk@ldeo.columbia.edu) if nargin3 % default is 2-d numd=2; end if ndims(Xanom)==2 numd==1 % data is (x,t) Xpcs=Xeofs'*Xanom; Xpcs=Xpcs'; else % nt=size(Xanom,3) % neofs=size(Xeofs,3) % Xpcs=repmat(NaN, ); % for it=1:nt % Xpcs(it,:)=squeeze(nansum(nansum(Xeofs.*repmat(Xanom(:,:,it), ))))'; % end % for ie=1:neofs % Xpcs(:,ie)=squeeze(nansum(nansum(Xanom.*repmat(Xeofs(:,:,ie), )))); % end % Flatten 2-d fields into single vector =size(Xanom); neofs=size(Xeofs,3); Xanom=reshape(Xanom, ); % (x,t) Xeofs=reshape(Xeofs, ); % (x,e) % remove NaNs inn=find(~isnan(Xanom(:,1))); Xanom=Xanom(inn,:); % (x,t) Xeofs=Xeofs(inn,:); % (x,e); Xpcs=Xeofs'*Xanom; Xpcs=Xpcs'; end function =principal_component_analysis(X,neof) % function =principal_component_analysis(X,neof) % Function to do a principal component analysis of % data matrix X. % Input: % X: (t,x) each row corrsponds to a sample, each column % is a variable. (Each column is a time series of a % variable.) % neof: number of EOF/PC to return % Output: % EOFs: (x,e) matrix with EOFs (loadings) in the columns % PCs: (t,e) matrix with principal components (scores) in the columns % Var: variance of each principal component % Xrecon: (t,x) reconstructed X (WITHOUT adding back the mean) % To reconstruct: Xrecon = PCs*EOFs' % Notes: (1) This routine will subtract off the mean of each % variable (column) before performing PCA. % (2) sum(var(X)) = sum(Var) = sum(diag(S)^2/(m-1)) % Samar Khatiwala (spk@ldeo.columbia.edu) if strcmp(class(X),'single') disp('WARNING: Converting input matrix X to class DOUBLE') end % Center X by subtracting off column means = size(X); %X = X - repmat(mean(X,1),m,1); r = min(m-1,n); % max possible rank of X % SVD if nargin 2 =svds(X,r); else =svds(X,min(r,neof)); end % EOFs: (x,e) % U: (t,e) % Determine the EOF coefficients PCs=U*S; % PCs=X*EOFs (t,e) % compute variance of each PC % Modified EV=diag(S).^2/sum( diag(S).^2 ); Var = EV*100; % Note: X = U*S*EOFs' % EOFs are eigenvectors of X'*X = (m-1)*cov(X) % sig^2 (=diag(S)^2) are eigenvalues of X'*X % So tr(X'*X) = sum(sig_i^2) = (m-1)*(total variance of X) if nargout3 Xrecon = PCs*EOFs'; % (t,x) end
5090 次阅读|3 个评论
fast runmean smoothing
热度 1 gwangcc 2012-11-1 16:37
function Y = runmean(X, m, dim, modestr) ; % RUNMEAN - Very fast running mean (aka moving average) filter % For vectors, Y = RUNMEAN(X,M) computes a running mean (also known as % moving average) on the elements of the vector X. It uses a window of % 2*M+1 datapoints. M an positive integer defining (half) the size of the % window. In pseudo code: % Y(i) = sum(X(j)) / (2*M+1), for j = (i-M):(i+M), and i=1:length(X) % % For matrices, Y = RUNMEAN(X,M) or RUNMEAN(X,M, ,1) % % - 1.33 2 3 4 4.67 % runmean( ,1,'mean') % % - 2 2 3 4 4 % runmean( ,1,1) % dimension 1 is larger than 2*(M=1)+1 ... % % - 2 4 6 8 10 % runmean(ones(10,7),3,2,'zero') ; % along columns, using mode 'zero' % runmean(repmat( ,5,1),2,2) ; % % - all NaN result % A = rand(10,10) ; A(2,7) = NaN ; % runmean(A,3,2) ; % % - column 7 is all NaN % runmean(1:2:10,100) % mean % % - 5 5 5 5 5 % % This is an incredibly fast implementation of a running mean, since % execution time does not depend on the size of the window. % % See also MEAN, FILTER % for Matlab R13 % version 3.0 (sep 2006) % Jos van der Geest % email: jos@jasen.nl % History: % 1.0 (2003) created, after a snippet from Peter Acklam (?) % 1.1 (feb 2006) made suitable for the File Exchange (extended help and % documentation) % 1.2 (feb 2006) added a warning when the window size is too big % 1.3 (feb 2006) improved help section % 2.0 (sep 2006) working across a dimension of a matrix. % 3.0 (sep 2006) several treatments of the edges. % Acknowledgements: (sep 2006) Thanks to Markus Hahn for the idea of % working in multi-dimensions and the way to treat edges. error(nargchk(2,4,nargin)) ; if ~isnumeric(m) || (numel(m) ~= 1) || (m 0) || fix(m) ~= m, error('The window size (M) should be a positive integer') ; end if nargin == 2, dim = ; else modestr = 'edge' ; end end modestr = lower(modestr) ; % check mode specifier if ~ismember(modestr,{'edge','zero','mean'}), error('Unknown mode') ; end szX = size(X) ; if isempty(dim), dim = min(find(szX1)) ; end if m == 0 || dim ndims(X), % easy Y = X ; else mm = 2*m+1 ; if mm = szX(dim), % if the window is larger than X, average all sz2 = ones(size(szX)) ; sz2(dim) = szX(dim) ; Y = repmat(mean(X,dim),sz2) ; else % here starts the real stuff % shift dimensions so that the desired dimensions comes first = shiftdim(X, dim-1); szX = size(X) ; % make the rest of the dimensions columns, so we have a 2D matrix % (suggested of Markus Hahn) X = reshape(X,szX(1), ; % the cumsum trick (by Peter Acklam ?) Y = cumsum(Y,1) ; Y = (Y(mm+1:end,:)-Y(1:end-mm,:)) ./ mm ; % reshape into original size Y = reshape(Y,szX) ; % and re-shift the dimensions Y = shiftdim(Y,ndims(Y)-nshifts) ; end end % ===================== % CODE OF VERSION 1.3 % ===================== % function Y = runmean(X,m) ; % % RUNMEAN - Very fast running mean filter for vectors % % Y = RUNMEAN(X,M) computes a running mean on vector X using a window of % % 2*M+1 datapoints. X is a vector, and M an positive integer defining % % (half) the size of the window. In pseudo code: % % Y(i) = sum(X(j)) / (2*M+1), for j = (i-M):(i+M), and i=1:length(X) % % % % If the total window size (2M+1) is larger than the length of the vector, the overall % % average is returned. % % % % Example: % % runmean(1:10,1) % - % % % % % % This is an incredibly fast implementation of a running average, since % % execution time does not depend on the size of the window. % % % % X should not contains NaNs (a NaN will result in a all NaN result) % % At both ends the values of Y can be inaccurate, as the first and last % % values of X are used multiple times. % % % % See also MEAN % % % for Matlab R13 % % version 1.3 (feb 2006) % % Jos van der Geest % % email: jos@jasen.nl % % % History: % % 1.0 (2003) created, after a snippet from Peter Acklam (?) % % 1.1 (feb 2006) made suitable for the File Exchange (extended help and % % documentation) % % 1.2 (feb 2006) added a warning when the window size is too big % % 1.3 (feb 2006) improved help section % % error(nargchk(2,2,nargin)) ; % % sz = size(X) ; % % if numel(sz) ~= 2 || (min(sz) ~= 1), % error('X should be a vector') ; % end % % if any(isnan(X)), % error('NaNs cannot be dealt with') ; % end % % if ~isnumeric(m) || (numel(m) ~= 1) || (m 0) || fix(m) ~= m, % error('The window size (M) should be a positive integer') ; % elseif m == 0, % Y = X ; % return ; % end % % mm = 2*m+1 ; % % if mm = prod(sz), % % if the window is larger than X, average all % warning('Window size is larger than the length of the vector.') % Y = repmat(mean(X),sz) ; % else % % the cumsum trick ... % Y = ; % Y = ; % Y = (Y(mm+1:end)-Y(1:end-mm)) / mm ; % Y = reshape(Y,sz) ; % end
3375 次阅读|1 个评论
SVD analysis of two climate fields
热度 1 gwangcc 2012-11-1 16:21
function = calSVD(xdata,ydata,N) =size(xdata); xdata=reshape(xdata, ); % =size(ydata); ydata=reshape(ydata, ); % innx= find(~isnan(xdata(:,10))); xdata=xdata(innx,:); xdata=permute(xdata, ); xdata=detrend(xdata,'constant'); xdata(isnan(xdata))=0; inny= find(~isnan(ydata(:,10))); ydata=ydata(inny,:); ydata=permute(ydata, ); ydata=detrend(ydata,'constant'); ydata=detrend(ydata); xdata(isnan(xdata))=0; %% S=xdata; P=ydata; % Form the covariance matrix: C = S'*P; % Find eigenvectors and singular values = svds(C,N); % PC a = S*U; b = P*V; % Make them clear for output for iN=1:N e1(iN,:) = squeeze( U(:,iN) )'; pcx(iN,:) = squeeze( a(:,iN) )'; e2(iN,:) = squeeze( V(:,iN) )'; pcy(iN,:) = squeeze( b(:,iN) )'; end % Amount of variance explained a 0.1 pres et en % L2=Lambda.^2; dsum=diag(L2)/trace(L2); for iN=1:N expvar(iN)=fix( ( dsum(iN)*100/sum(dsum) )*10 ) /10; end %% reshape zforp to 3-D physical space ex=repmat(NaN, ); for i=1:N ex(innx,i)=e1(i,:); end ex=squeeze(reshape(ex, )); ey=repmat(NaN, ); for i=1:N ey(inny,i)=e2(i,:); end ey=squeeze(reshape(ey, ));
3119 次阅读|1 个评论
estimating PDF with kernels
gwangcc 2012-10-25 23:27
function p=gkdeb(x,p) % GKDEB Gaussian Kernel Density Estimation with Bounded Support % % Usage: % p = gkdeb(d) returns an estmate of pdf of the given random data d in p, % where p.pdf and p.cdf are the pdf and cdf vectors estimated at % p.x locations, respectively and p.h is the bandwidth used for % the estimation. % p = gkdeb(d,p) specifies optional parameters for the estimation: % p.h - bandwidth % p.x - locations to make estimation % p.uB - upper bound % p.lB - lower bound. % p.alpha - to calculate inverse cdfs at p.alpha locations % % Without output, gkdeb(d) and gkdeb(d,p) will disply the pdf and cdf % (cumulative distribution function) plot. % % See also: hist, histc, ksdensity, ecdf, cdfplot, ecdfhist % Example 1: Normal distribution %{ gkdeb(randn(1e4,1)); %} % Example 2: Uniform distribution %{ clear p p.uB=1; p.lB=0; gkdeb(rand(1e3,1),p); %} % Example 3: Exponential distribution %{ clear p p.lB=0; gkdeb(-log(1-rand(1,1000)),p); %} % Example 4: Rayleigh distribution %{ clear p p.lB=0; gkdeb(sqrt(randn(1,1000).^2 + randn(1,1000).^2),p); %} % V3.2 by Yi Cao at Cranfield University on 7th April 2010 % % Check input and output error(nargchk(1,2,nargin)); error(nargoutchk(0,1,nargout)); n=length(x); % Default parameters if nargin2 N=100; h=median(abs(x-median(x)))/0.6745*(4/3/n)^0.2; xmax=max(x); xmin=min(x); xmax=xmax+3*h; xmin=xmin-3*h; dx=(xmax-xmin)/(N-1); p.x=xmin+(0:N-1)*dx; p.pdf=zeros(1,N); p.cdf=zeros(1,N); p.h=h; dxdz=ones(size(p.x)); z=p.x; else =checkp(x,p); N=numel(p.x); h=p.h; end % Gaussian kernel function kerf=@(z)exp(-z.*z/2); ckerf=@(z)(1+erf(z/sqrt(2)))/2; nh=n*h*sqrt(2*pi); for k=1:N p.pdf(k)=sum(kerf((p.x(k)-x)/h)); p.cdf(k)=sum(ckerf((p.x(k)-x)/h)); end p.x=z; p.pdf=p.pdf.*dxdz/nh; dx= ; p.cdf=p.cdf/n; % p.cdf=cumsum(p.pdf.*dx); if isfield(p,'alpha') n=numel(p.alpha); p.icdf=p.alpha; for k=1:n alpha=p.alpha(k); ix=find(p.cdfalpha,1)-1; x1=p.x(ix); x2=p.x(ix+1); F1=p.cdf(ix); F2=p.cdf(ix+1); p.icdf(k)=x1+(alpha-F1)*(x2-x1)/(F2-F1); end end % Plot if ~nargout subplot(211) plot(p.x,p.pdf,'linewidth',2) grid % set(gca,'ylim', ) ylabel('f(x)') title('Estimated Probability Density Function'); subplot(212) plot(p.x,p.cdf,'linewidth',2) ylabel('F(x)') title('Cumulative Distribution Function') xlabel('x') grid meanx = sum(p.x.*p.pdf.*dx); varx = sum((p.x-meanx).^2.*p.pdf.*dx); text(min(p.x),0.6,sprintf('mean(x) = %g\n var(x) = %g\n',meanx,varx)); if isfield(p,'alpha') numel(p.alpha)==1 text(min(p.x),0.85,sprintf('icdf at %g = %g',p.alpha,p.icdf)); end end function =checkp(x,p) n=numel(x); %check structure p if ~isstruct(p) error('p is not a structure.'); end if ~isfield(p,'uB') p.uB=Inf; end if ~isfield(p,'lB') p.lB=-Inf; end if p.lB-Inf || p.uBInf =bounded(x,p); else if ~isfield(p,'h') p.h=median(abs(x-median(x)))/0.6745*(4/3/n)^0.2; end error(varchk(eps, inf, p.h, 'Bandwidth, p.h is not positive.')); if ~isfield(p,'x') N=100; xmax=max(x); xmin=min(x); xmax=xmax+3*p.h; xmin=xmin-3*p.h; dx=(xmax-xmin)/(N-1); p.x=xmin+(0:N-1)*dx; end dxdz=ones(N,1); z=p.x; end p.pdf=zeros(size(p.x)); p.cdf=zeros(size(p.x)); function =bounded(x,p) if p.lB==-Inf dx=@(t)1./(p.uB-t); y=@(t)-log(p.uB-t); zf=@(t)(p.uB-exp(-t)); elseif p.uB==Inf dx=@(t)1./(t-p.lB); y=@(t)log(t-p.lB); zf=@(t)exp(t)+p.lB; else dx=@(t)(p.uB-p.lB)./(t-p.lB)./(p.uB-t); y=@(t)log((t-p.lB)./(p.uB-t)); zf=@(t)(exp(t)*p.uB+p.lB)./(exp(t)+1); end x=y(x); n=numel(x); if ~isfield(p,'h') p.h=median(abs(x-median(x)))/0.6745*(4/3/n)^0.2; end h=p.h; if ~isfield(p,'x') N=100; xmax=max(x); xmin=min(x); xmax=xmax+3*h; xmin=xmin-3*h; p.x=xmin+(0:N-1)*(xmax-xmin)/(N-1); z=zf(p.x); else z=p.x; p.x=y(p.x); end dxdz=dx(z); function msg=varchk(low,high,n,msg) % check if variable n is not between low and high, returns msg, otherwise % empty matrix if n=low n=high msg=[]; end
3048 次阅读|0 个评论

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-6-2 06:50

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部