Hello, I am wanting to arrange the h values I am calculating into an array. I want to do this so that if I type in h(x) I can get the value for that. For example, I want to type it in such that if I type in h(0) it will spit out the value for that number. Any help would be appreciated. The below formula gives me the correct h values for each ply. But, I do not know how to arrange into an array.
% define an array h that stores the location of ply interfaces here ...
% the array should be the length of the theta array plus one (i.e., there
% are n+1 interfaces for a n ply laminate)
% be careful to take account of the cases of even and odd number of plies
% when there are an odd number of plies, interfaces are located at 1.5t, 2.5t, etc.
for x=0:n
h=t*(x-(n/2))
end

댓글 수: 1

Chad Greene
Chad Greene 2021년 5월 2일
An important thing to note is that if you define h, and then try typing h(0), you will get an error. That's because h(1) returns the first value in the vector h, h(2) gives the second value in h, and so on. There isn't anything before the first element in h.
I think you want to define a function for h that will give you h(x,n,t).

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

질문:

2021년 5월 2일

댓글:

2021년 5월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by