Isight计算器编程规则.doc_第1页
Isight计算器编程规则.doc_第2页
Isight计算器编程规则.doc_第3页
Isight计算器编程规则.doc_第4页
Isight计算器编程规则.doc_第5页
已阅读5页,还剩1页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1. Basicy = 0.23 * x3 - 2.1 * x2 + 3.5 * x - 5z = sin(x/2)2 + cos(x/2)2z2 = exp(z - 1)2.The Rules# Examples of basic math in the Calculator/ Comments start with # or / and go to end of line/ Note that every statement starts with assignment to a variable, / array element, or aggregate member.y = 3.0 * x2# The usual operator precedence applies - 4 * x + # is exponentiation x % 5 - # % is modulus operator 5.0# Expressions can be split over multiple lines at any pointa0=5; a1=6; a2=7# or put multiple statements on one linei = 5ai-1 = a0 * ai-2# directly access array elementssin = sin(0.0)# variables and functions can have the same namenorm = sqrt(cmplx.real2 + cmplx.im2)# directly access aggregate members= 99# directly use non-ASCII charactersparameter names with punctuation = require+quotesX = A0 - SIN(NorM - SiN) # Everything ignores caseflag = a0 = a1 & a1 = a2x2 = a2d3,4# but not in subscriptszero = sin(pi()/2) - ln(e()# constants are functions with no argumentsj + = 1# op-assign. Same as j = j + 1flag &= zero = 0.0# combine boolean results# Use of special value - NaN and Infinityinfinity = 1.0 / 0.0#results may be special values in IEEE arithmeticnot_a_number = 0.0 / 0.0minus_infinity = ln(0.0)# Math on special values does nasty things - Infinity + -Infinity = NaNuseless = 5 * infinity + minus_infinityanother_zero = 345 / infinity# But some things workone_and_a_half = 3/2# division is always done as reals# However, modulus is done in integer if both arguments are integers# the following statement causes a fatal error when you press Calculate/ bad = 5 % 03.Arrays# Any operator or basic function applied to an array # applies to each element of the array and returns an array of the same size.# Note that the Array Parameters A, B, and C had to be pre-created.B = A * 2 - 5C = abs(B) * A# D was automatically created in the following statement# since it is obvious that it is an array.D5 = A0 * A1# And D is automatically resized for larger subscripts.D6 = A2 * A3 224.Statistics# Statistical functions can take multiple scalar valuessum1 = sum(3, -4, 0)max1 = max(3, -4, 0)min1 = min(3, -4, 0)absMin1 = absMin(3, -4, 0)absMax1 = absMax(3, -4, 0)absSum1 = absSum(3, -4, 0)mean1 = mean(3, -4, 0)stddev1 = stddev(3, -4, 0)# They can also be applied to one array.sum2 = sum(B)max2 = max(B)min2 = min(B)absMin2 = absMin(B)absMax2 = absMax(B)absSum2 = absSum(B)mean2 = mean(B)stddev2 = stddev(B)# There are also functions that apply ONLY to arraysmaxIdx = maxIdx(B)minIdx = minIdx(B)absMaxIdx = absMaxIdx(B)absMinIdx = absMinIdx(B)size = size(B)# If you mix arrays and scalars, it applies per-element to the ArrayB2 = max(B, 0.0)# you can also mix things up quite a bit.max_pred = BmaxIdx(B)-1 * sum(min(B, 0.0)# Normalize an array of pointsBnormal = (B - mean(B) / stddev(B)# Sum-of-squaresBssq = sum(B2)# Distance from the origin in N-dimensional spacedist = sqrt(sum(B2)5 Plugins(插件程序)/ To see expressions and results, click Calculate and then click . button/ next to status line./ The following line indicates that the StringFunctions plugin is needed#import com.engineous.plugin.calculation.StringFunctionsa = Sling# String constants use double quotesb = a & Shot# use new operator & to concatenate strings# Play around with string functionsc = concat(a, , 12)# same as & but as a functionlen = strlen(b)# length of stringidx = index(b, Sh)# index of sh in b, first char is 0c2 = upcase(a) & & downcase(b) # convert to upper/lower caseslings = substr(c2, 6, 12)# extract substring, counting from 0# split and join convert between strings and string arraysstring array = split(Fred,Wylma,Barney,Betty, ,)Flinstones = join(string array, and )6 MatrixL_tot = L1+L2;# Stiffness matrix for element 1EIL1 = E1*I1/(L1*L1*L1);K1 = zeros(4,4);K10,0 = 12; K10,1 = 6.0 * L1; K11,0 = 6.0 * L1; K10,2 = -12; K12,0 = -12; K10,3= 6*L1; K13,0 = 6*L1;K11,1 = 4*L1*L1; K11,2=-6.0 *L1;K12,1 = -6.0 *L1; K11,3 = 2*L1*L1; K13,1 = 2*L1*L1;K12,2 = 12; K12,3 = -6.0 * L1;K13,2 = -6.0 * L1;K13,3 = 4*L1*L1;K1 = EIL1 * K1;# Map the local degrees of freedom = global dofdof10 = 4;dof11 = 5;dof12 = 0;dof13 = 1;# transformed stiffness matrix, i.e. contribution to the global stiffness matrix GK1 = zeros(6,6);GK1dof10,dof10 = K10,0; GK1dof10,dof11 = K10,1; GK1dof10,dof12 = K10,2; GK1dof10,dof13 = K10,3;GK1dof11,dof10 = K11,0; GK1dof11,dof11 = K11,1; GK1dof11,dof12 = K11,2; GK1dof11,dof13 = K11,3;GK1dof12,dof10 = K12,0; GK1dof12,dof11 = K12,1; GK1dof12,dof12 = K12,2; GK1dof12,dof13 = K12,3;GK1dof13,dof10 = K13,0; GK1dof13,dof11 = K13,1; GK1dof13,dof12 = K13,2; GK1dof13,dof13 = K13,3;# Stiffness matrix for element 2EIL2 = E2*I2/(L2*L2*L2);K2 = zeros(4,4);K20,0 = 12; K20,1 = 6.0 * L2; K21,0 = 6.0 * L2; K20,2 = -12; K22,0 = -12; K20,3 = 6*L2; K23,0 = 6*L2;K21,1 = 4*L2*L2; K21,2 = -6.0 *L2; K22,1 = -6.0 *L2; K21,3 = 2*L2*L2; K23,1 = 2*L2*L2;K22,2 = 12; K22,3 = -6.0 * L2; K23,2 = -6.0 * L2;K23,3 = 4*L2*L2;K2 = EIL2*K2# Map local degrees of freedom = global dofdof20 = 0;dof21 = 1;dof22 = 2;dof23 = 3;# transformed stiffness matrix, i.e. contribution to the global stiffness matrix GK2 = zeros(6,6);GK2dof20,dof20 = K20,0; GK2dof20,dof21 = K20,1; GK2dof20,dof22 = K20,2; GK2dof20,dof23 = K20,3;GK2dof21,dof20 = K21,0; GK2dof21,dof21 = K21,1; GK2dof21,dof22 = K21,2; GK2dof21,dof23 = K21,3;GK2dof22,dof20 = K22,0; GK2dof22,dof21 = K22,1; GK2dof22,dof22 = K22,2; GK2dof22,dof23 = K22,3;GK2dof23,dof20 = K23,0; GK2dof23,dof21 = K23,1; GK2dof23,dof22 = K23,2; GK2dof23,dof23 = K23,3;# Stiffness matrix for the structure - assemble using dofsK = GK1 + GK2;Kinv = inv(K);# Force-displacement equation (displacements d2 and d3 are zero)Kred = zeros(4,4);Kred0,0 = K0,0; Kred0,1 = K0,1; Kred0,2 = K0,4; Kred0,3 = K0,5;Kred1,0 = K1,0; Kred1,1 = K1,1; Kred1,2 = K1,4; Kred1,3 = K1,5;Kred2,0 = K4,0; Kred2,1 = K4,1; Kred2,2 = K4,4; Kred2,3 = K4,5;Kred3,0 = K5,0; Kred3,1 = K5,1; Kred3,2 = K5,4; Kred3,3 = K5,5;# loads (at known/reduced locations)Lred0,0 = F1;Lred1,0 = M1;Lred2,0 = F3;Lred3,0 = M3;# calculate global displacementsdred = prod(inv(Kred), Lred);d0,0 = dred0,0; d1,0 = dred1,0; d2,0 = d3,0 = 0; d4,0 = dred2,0; d5,0 =

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论