Hi, I'm trying to create a function with matrix, but a heve not got, the results shall be k1 = [100 -100; -100 100], and my function have been that:
function y = SpringElementStiffness(k)
y = [k -k; -k k];
end
k1=SpringElementStiffness(100)
I Thank you by your attention.

 채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 17일

0 개 추천

Create a file named SpringElementStiffness.m:
function y = SpringElementStiffness(k)
y = [k -k; -k k];
end
and then in the command window, run
>> k1=SpringElementStiffness(100)
k1 =
100 -100
-100 100

댓글 수: 2

Rafael Zanetti
Rafael Zanetti 2020년 4월 17일
Thank you Ameer Hamza
Ameer Hamza
Ameer Hamza 2020년 4월 18일
I am glad to be of help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

제품

질문:

2020년 4월 17일

댓글:

2020년 4월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by