libertyvasup.blogg.se

Labview mathscript download
Labview mathscript download












(In LabVIEW,arrayindexesstartswithzero.)Forexample(assumingmatrix A=isstillintheWorkspace),toaddressthe(2,1)elementofAandassign thevalueofthatelementtothevariablew: w=A(2,1) withresultw=3. Matricesandvectors Tocreatearowvector fromsay0to4withincrement0.5: R2= Tocreateacolumnvector fromsay0to4withincrement1: R3=' Youcancreatematricesbycombiningvectors (ormatrices): C1=' C2=' M= Herearesomespecialmatrices: Youcanaddress anelementinamatrixusingthestandard(rownumber,column number)indexing.Note:Theelementindexesstartswithone,notzero. Tocreateamatrix,usecommatoseparatetheelementsofarowand semicolontoseparatecolumns.Forexample,tocreateamatrixhaving numbers1and2inthefirstrowand3and4inthesecondrow: A= withtheresult A= 12 34 Totransposeamatrixusetheapostrophe: B=A' Tocreatearowvectorfromsay0to4withincrement1: R1= Matricesandvectors ThematrixisthebasicdataelementinMathScript.Amatrixhavingonly oneroworonelinearefrequentlydenotedvector.Belowareexamplesof creatingandmanipulatingmatrices(andvectors). NumberFormats Youcanenternumbersinvariousways: x1=0.1 x2=1e1 x3=2e2 x4=2*10^(2) x5=exp(1) (thenaturalbase,e=e1 =2.7183) 圆=1+2i (acomplexnumber)ĪllvariablesgeneratedinaMathScript session(asessionlasts betweenlaunchingandquittingMathScript)aresavedinthe MathScript Workspace.Youcanseethecontentsofthe WorkspaceusingthemenuTools/Workspace/Variables (tab).Alternatively,youcanusethewhocommand:who YoucandeleteavariablefromtheWorkspace: clear圆 MathScript functionsarepolymorphic,i.e.theytypicallytake bothscalarsandvectors(arrays)asarguments.Asan example,thefollowingtwocommandscalculatethesquare rootofthescalar2andthesquarerootofeachofthe elementsofthevectorofintegersfrom0to5,respectively: sqrt(2) sqrt() Whentheargumentisavectorasinthiscase,thecalculation issaidtobevectorized. NumberFormatsTheformatcommandisusedtoselectbetweendifferent formatsoftheoutput,cf.theinformationabouttheformat commandthatyousawabove.Trythefollowingcommands: formatshort,100*pi (Comment:5digits,exceptpossible trailingzeros,areshown.) formatlong,100*pi (16digits.) formatshorte,100*pi (5digitsandatermshowingthe exponentsof10) formatlonge,100*pi (16digitsandatermshowingthe exponentsof10) Inmostcasesformatshortisok.Thisisalsothedefault format.Toresettoformatshort: formatshort LearningtheMathScript languageCasesensitivity MathScript iscasesensitive:Help Aboveyouusedthehelpcommand.Itcommand displaysinformationaboutaknowncommand, typicallyincludinganexample.Tryhelpsin Torecallapreviouscommandstartingwith certaincharacters,typethesecharacters followedbypressingtheArrowDownbuttonon thekeyboard.Tryrecallingtheprevious command(s)beginningwiththeacharacter: LearningtheMathScript languageRecallingpreviouscommands Torecallpreviouscommands,presstheArrowUp buttononthekeyboardasmanytimesas needed. a=5 b=7,c=a+b Withtheabovecommandsthevalueofaisnotdisplayed, whilethevaluesofbandcaredisplayed Withsemicolontheresultofthecommandisnotdisplayedin theOutputwindow,butthecommandisexecuted. Severalcommandsmaybewrittenononeline,separatingthe commandsusingeithersemicolonorcomma. LearningtheMathScript language 1+2 Theresultis3 Toadd4toans: ans+4 LearningtheMathScript languageStartup OpentheMathScript window(menuTools/MathScript Window).ĮxecutethefollowingcommandsintheCommand window(bypressingtheEnterbuttononthe keyboard),andobservetheresultsintheOutput window. History:Showsalistofpreviouscommandsthatyouhaveexecuted. Script:Opensascripteditor.ToopenanotherScripteditor:Select themenu(intheMathScript window)File/NewScriptEditor. Mathscript UsingMathscript WindowTheWorkspacewindow,whichcontainstheVariables,Script,and History(sub)windows containingthefollowingtabs: Variables:Listsgeneratedvariables.Thenumericalvalueofthese variablescanbedisplayed.Thevaluecanalsobeplottedgraphically byselectingGraphicsFirstintheVariablesdialogwindow. Output Windowwhere executed commands and numerical results are shown. LabVIEW MathscriptMathScript canbeusedintwoways: InaMathScript node whichappearsasaframe insidetheBlockdiagramofaVI(availableonthe Functions/Mathematics/Scripts&Formulas palette.) InaMathScript window asadesktop mathematicaltoolindependentofLabVIEW LabVIEW MathscriptALabVIEW toolforexecutingtextualmathematical commands Matrixandvectorbasedcalculations(linearalgebra) Visualizationofdatainplots Runningscriptscontaininganumberofcommandswritten inafile Alargenumberofmathematicalfunctions.MathScript commandareequaltoMATLABcommands(some MATLABcommandsmaynot beimplemented).














Labview mathscript download