MATLAB Beam Project: Multiple Inputs for Applied Loads and Positions

  • Context: MATLAB 
  • Thread starter Thread starter bakin
  • Start date Start date
  • Tags Tags
    Matlab Multiple
Click For Summary
SUMMARY

The discussion focuses on implementing a MATLAB project for a beam with multiple applied loads. The user seeks guidance on how to prompt for user input based on the number of loads specified. The solution involves using a for loop to iterate through the number of loads, allowing the user to input both the load values and their respective positions. This approach successfully creates two arrays to store the load and position data, facilitating further calculations.

PREREQUISITES
  • Basic understanding of MATLAB programming
  • Familiarity with loops in programming, specifically for loops
  • Knowledge of arrays in MATLAB
  • Concept of user input handling in MATLAB
NEXT STEPS
  • Explore MATLAB for loop syntax and best practices
  • Learn about array manipulation in MATLAB
  • Research user input functions in MATLAB, such as input()
  • Investigate beam load calculation methods in structural engineering
USEFUL FOR

Students, engineers, and developers working on structural analysis projects in MATLAB, particularly those dealing with multiple load applications on beams.

bakin
Messages
55
Reaction score
0
Hello. I have to do a beam project in MATLAB. Similar to this: (I just google imaged this)
http://teaching.ust.hk/~mech101/images/4_poin22.gif
Just a simple beam with one or more applied loads.

What I'm trying to do, is ask the user how many total loads are being applied to the beam. Once I have this answer, I want to have the user enter how much the load is, and what the position is. But, my problem is that once I have a number for how many loads there are, I don't know how to have that many questions asked. For example, if there are two loads, how do I get it to ask the user two times? Or if there are 4 loads, ask them for 4 separate values? I'm thinking it might be a for loop, or some type of loop depending on the number inputted.

Thanks!
 
Last edited by a moderator:
Physics news on Phys.org
A for loop sounds like the way to go. First, ask the user to enter the number N of loads, where N should be an integer 1 or larger.

Then a for loop executes N times (for i=1:N) asking for for load(i) and position(i). After the for loop finishes you should have two arrays with N entries, load(1), load(2), ..., load(N), and position(1), ..., position(N). Then you're ready to do your load calculation.
 
makes sense. ill give that a shot here soon and let you know how it works. thank you for the help :biggrin:


edit: That definitely did work :smile: Now I can continue working with this. Thank you very much! :wink:
 
Last edited:

Similar threads

  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K