[Solved] Need Plot Rollercoaster Matlab Given Gui Teacher Need Use Code Order Create Two Tracks Loo Q37280699
I need to plot a rollercoaster in MATLAB. We were given a GUI byour teacher which we need to use with our own code in order tocreate two tracks with loop the loops that has a cart roll alongit. I believe I can figure out how to implement the GUI andcalculate the g forces, however, I cannot figure out how to plot aloop for the track. I have included the GUI, if the answer coulduse the GUI to roll a ball or cart along the track that would beawesome. I could also just use the code for how to plot a loop likea rollercoaster track.
function sample_GUI(varargin)
close all;clear;
global A option PrpHndl;
scrnsize=get(0,’screensize’);
scrnlen=0.7*scrnsize(3);scrnwid=0.8*scrnsize(4);
figurePos=round([scrnsize(3)/2-scrnlen/2,scrnsize(4)/2-scrnwid/2,scrnlen,scrnwid]);
FigureTitle=’A Very Simple GUI, Prof. Yi, Copyright 2018′;
figure( …
‘Name’,FigureTitle,…
‘NumberTitle’,’off’, …
‘DoubleBuffer’,’on’, …
‘menubar’,’none’, …
‘Color’,[1 1 1]*0.8, …
‘BackingStore’,’on’,…
‘position’,figurePos);
axes( …
‘Box’,’on’, …
‘Units’,’normalized’, …
‘Position’,[0.1 0.2 0.6 0.65], …
‘Visible’,’on’, …
‘NextPlot’,’replace’);
%============================================
%menu on the figure top
menu0=uimenu(1,’label’,’Menu’);
callbackStr=…
‘[fnm,fpath]=uigetfile(”*.*”);iffnm~=0;edit(fullfile(fpath,fnm));end;’;
uimenu(‘parent’,menu0,’label’,’EditFile’,’callback’,callbackStr);
uimenu(‘parent’,menu0,’label’,’Save A’,’callback’,’global A;saveA.txt A -ascii’);
uimenu(‘parent’,menu0,’label’,’Load A’,’callback’,…
‘global A PrpHndl;loadA.txt;set(PrpHndl,”string”,num2str(A));’);
%===============================================
% initialize variables defining spacings
labelColor=[1,1,1]*0.8;
yInitPos=0.96;
xPos=0.82;
btnLen=0.14;
btnWid0=0.1;
spacing0=0.05;
fontsize=14;
%====================================
% The BLUE CONSOLE frame
frmBorder=0.015;
yPos=0.04-frmBorder;
frmPos=[xPos-frmBorder, yPos, btnLen+2*frmBorder,0.9+2*frmBorder];
h=uicontrol( …
‘Style’,’frame’, …
‘Units’,’normalized’, …
‘Position’,frmPos, …
‘BackgroundColor’,[0 0 0.5]);
spacing=spacing0*0.6;
btnWid=btnWid0*1.;
%====================================
% The edit box to assign parameter A
btnNumber=1;
yPos=0.90-(btnNumber-1)*(btnWid+spacing)-0.3*btnWid;
A=10.0;
callbackStr=’global A; A=str2num(get(gcbo,”string”));’;
btnPos=[xPos yPos-spacing btnLen btnWid*0.7];
PrpHndl=uicontrol( …
‘Style’,’edit’, …
‘Units’,’normalized’, …
‘fontsize’,fontsize,…
‘Position’,btnPos, …
‘String’,’10.0′,…
‘Callback’,callbackStr);
%====================================
% The options button
btnNumber=2;
yPos=0.90-(btnNumber-1)*(btnWid+spacing)-0.3*btnWid;
btnPos=[xPos yPos-spacing btnLen btnWid];
option=1;
OptHndl=uicontrol( …
‘Style’,’popup’, …
‘Units’,’normalized’, …
‘fontsize’,fontsize,…
‘Position’,btnPos, …
‘Callback’,’global option; option=get(gcbo,”value”);’,…
‘Value’,1,…
‘String’,’y=sqrt(Ax)|y=sin(Ax)|y=exp(-Ax)’);
%====================================
% the Draw button
callbackStr=’myfunction;’;
btnNumber=3;
yPos=0.90-(btnNumber-1)*(btnWid+spacing)-0.3*btnWid;
labelStr=’Draw’;
btnPos=[xPos yPos-spacing btnLen btnWid];
startHndl=uicontrol( …
‘Style’,’pushbutton’, …
‘Units’,’normalized’, …
‘fontsize’,fontsize,…
‘Position’,btnPos, …
‘String’,labelStr, …
‘Callback’,callbackStr);
%====================================
% The Help button
btnNumber=6;
yPos=0.90-(btnNumber-1)*(btnWid+spacing)-0.3*btnWid;
btnPos=[xPos yPos-spacing btnLen btnWid];
labelStr=’Help’;
callbackStr=’msgbox(”Contact Prof. Yi at DU to learnmore!”);’;
infoHndl=uicontrol( …
‘Style’,’push’, …
‘Units’,’normalized’, …
‘fontsize’,fontsize,…
‘Position’,btnPos, …
‘String’,labelStr, …
‘Callback’,callbackStr);
%====================================
% The Quit button
btnNumber=7;
yPos=0.90-(btnNumber-1)*(btnWid+spacing)-0.3*btnWid;
btnPos=[xPos yPos-spacing btnLen btnWid];
labelStr=’Quit’;
callbackStr=’close all;’;
closeHndl=uicontrol( …
‘Style’,’push’, …
‘Units’,’normalized’, …
‘fontsize’,fontsize,…
‘Position’,btnPos, …
‘String’,labelStr, …
‘Callback’,callbackStr);
end
Expert Answer
Answer to I need to plot a rollercoaster in MATLAB. We were given a GUI by our teacher which we need to use with our own code in o… . . .
OR

