What is wrong in my coding?

1 visualizzazione (ultimi 30 giorni)
MR JUSTIN ACHARJEE Sumanta
Risposto: KSSV il 20 Gen 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

Risposte (1)

KSSV
KSSV il 20 Gen 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

Categorie

Scopri di più su Mathematics in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by