make array for h ?

1 view (last 30 days)
Steven P.
Steven P. on 2 May 2021
Commented: Chad Greene on 2 May 2021
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 Comment
Chad Greene
Chad Greene on 2 May 2021
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).

Sign in to comment.

Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!