What is wrong in my coding?

2 views (last 30 days)
Answered: KSSV on 20 Jan 2022
Enter length of a statically determined beam and positions of the pinned support and the roller support. The process must be user-friendly, with step-by-step instructions and appropriate control of the entered data.
%%Q1a
clear;clc;
% Get the span of the beam along with positions of supports
l = input('Enter the span of the beam');%m
x =input('Enter the distance of pinned support from left end in m')
y = input('Enter the distance of roller support from left end in m')
% Check if the support locations specified are inside the span
while((x >l) || (y >l)
sprint('The support location should be inside the span')
x = input('Reenter the value of x')
y = input(' Reenter the value of y')
end
disp('OK')
% Check if the supports are not given at the same location
while((x == y))
sprintf('The supports cannot be at the same location')
x = input('Reenter the value of x')
y = input(' Reenter the value of y')
end
disp('OK')
% Check if the beam is overhanging or simply supported
if((x<l)&&(y<l))
sprintf('The beam is overhanging')
else('The beam is simply supported')
end

KSSV on 20 Jan 2022
clc; clear all ;
%%Q1a
clear;clc;
% Get the span of the beam along with positions of supports
l = input('Enter the span of the beam');%m
x =input('Enter the distance of pinned support from left end in m') ;
y = input('Enter the distance of roller support from left end in m') ;
% Check if the support locations specified are inside the span
while((x >l) || (y >l))
sprintf('The support location should be inside the span')
x = input('Reenter the value of x') ;
y = input(' Reenter the value of y') ;
end
disp('OK')
% Check if the supports are not given at the same location
while((x == y))
sprintf('The supports cannot be at the same location')
x = input('Reenter the value of x') ;
y = input(' Reenter the value of y') ;
end
disp('OK')
% Check if the beam is overhanging or simply supported
if((x<l)&&(y<l))
sprintf('The beam is overhanging')
else
sprintf('The beam is simply supported')
end