Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

So I keep getting this error when I try to run my script Subscript indices must either be real positive integers or logicals. And with

So I keep getting this error when I try to run my script "Subscript indices must either be real positive integers or logicals." And with further inspection it seems that, that is because my function file is operating properly but I'm getting negative integers in my array.. which using the sample numbers is exactly what is supposed to happen. What am I missing from my function/script to stop this?

_____________Script___________________________________________________________________

L=input('Enter a positive value for the length of the beam in inches: ');

P=input('Enter a positive value for the mass of the load in pounds: ');

E=input('Enter a positive value for modulus of elastifity in psi: ');

I=input('Enter a positive value for moment of inertia: ');

A=input('Enter a value (greater than or equal to 2) for the number of equidistant points for the deflection to be calculated along the beam: ');

max_Def(1i)=(-P*b.*((L^2)-(b.^2))^(3/2))/(9*(sqrt(3))*E*I*L);

b=L-A;

def_at_Load(1i)=((-P*A^2)*(b.^2))/(3*E*I*L);

def_at_Center(1i)=(-P*b.((3*L^2)-(4*b.^2)))/(48*E*I);

deflection [max_Def,def_at_Load,def_at_Center]

_______________________________________________Function_________________________________

function [ max_Def,def_at_Load,def_at_Center ] = deflection( A,P,I,L,E )

%DEFLECTION to calculate the Max def. a def at load, and def in the center

%of a beam

b=L-A;

for j=1:length(A)

max_Def(j)=(-P*b.*((L^2)-(b.^2))^(3/2))/(9*(sqrt(3))*E*I*L);

def_at_Load(j)=((-P*A^2)*(b.^2))/(3*E*I*L);

def_at_Center(j)=(-P*b.((3*L^2)-(4*b.^2)))/(48*E*I);

end

x=0;

while x<=0

x=input('Enter x as a positive number: ');

if x<=0

fprintf(' You entered a non-positive number. ');

end;

end;

end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

More Books

Students also viewed these Databases questions

Question

How is lean production associated with JIT?

Answered: 1 week ago

Question

=+b) Is there evidence that the proportion has changed?

Answered: 1 week ago

Question

=+j Explain the relationship between unions and MNEs.

Answered: 1 week ago