Calling function error in MAtlab

E=70e6
A= 0.004
L1=3.5
theta1=90
L2=4
theta2=0
L3=5.3151
theta3= atan(3.5/4)*180/pi
L4=L3
theta4=360-theta3
L5=4
theta5=0
L6=3.5
theta6=270
k1=PlaneTrussElementStiffness(E,A,L1,theta1)

4 Comments

Error in below command
k1=PlaneTrussElementStiffness(E,A,L1,theta1)
please solve this problem
What you posted is fine. Perhaps there is a problem inside PlaneTrussElementStiffness which you did not post the code for.
can you post the produced err in the command window?

Sign in to comment.

Answers (1)

I guess you have not downloaded/ copied the function PlaneTrussElementStiffness in your working folder. It is not an inbuilt function, it is a user written function. You need to download the function. The function is given below and taken from the link https://github.com/seevven/matlab_vision/blob/master/M-Files/PlaneTrussElementStiffness.m .
function y = PlaneTrussElementStiffness(E,A,L, theta)
%PlaneTrussElementStiffness This function returns the element
% stiffness matrix for a plane truss
% element with modulus of elasticity E,
% cross-sectional area A, length L, and
% angle theta (in degrees).
% The size of the element stiffness
% matrix is 4 x 4.
x = theta*pi/180;
C = cos(x);
S = sin(x);
y = E*A/L*[C*C C*S -C*C -C*S ; C*S S*S -C*S -S*S ;
-C*C -C*S C*C C*S ; -C*S -S*S C*S S*S];
end

Categories

Find more on Function Creation in Help Center and File Exchange

Products

Release

R2020b

Asked:

on 31 May 2021

Answered:

on 31 May 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!