Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am trying to program on Matlab and there is something wrong with my code. I st

ID: 3766641 • Letter: I

Question

I am trying to program on Matlab and there is something wrong with my code. I still do not get what is it. I am assuming it is defining the variables because they are uderlined for me in te Editor.

-------------Here is my code Under the Button Group 1:

A=get(hObject,'String');

switch A

case 'Aluminum'

handle.h=set(handles.text2,'String', 'h= 35 W/m2.K');

handle.k=set(handles.text3,'String', 'k= 205 W/m.k ');

h=35;

k=205;

case 'Copper'

set(handles.text2, 'String', 'h= 120 W/m2.K');

set(handles.text3,'String', 'k= 385 W/m.K ');

case 'Stainless steel'

set(handles.text2,'String','h= 25 W/m2.K');

set(handles.text3,'String', 'k= 50.2 W/m.K');

end

-------------Here is my code Under the Button Group 2: IT IS INCOMPLETE, I AM TRYING TO DISCOVER THE MISTAKE AND MAINLY WORKING ON THE PARABOLIC CHOICE

function uipanel4_SelectionChangeFcn(hObject, eventdata, handles)

B=get(hObject,'String');

switch B

case 'Rectangular';

L=set(handles.text5,'String','Length');

w=set(handles.text6,'String', 'Width:');

t=set(handles.text7,'String', 'Thickness:');

get(handles.edit1,'String')

get(handles.edit2,'String')

get(handles.edit3,'double')

h=set(handles.text2,'String');

k=set(handles.text3,'String');

m=((2*h)/(k*t)).^0.5;

L_c=L+(t/2);

Areafin=str2double(2*w*L_c);

Finefficiency= str2double(tanh(m*L_c)/(m*L_c));

case 'Annular'

t=set(handles.text5,'String','Thickness:');

r2=set(handles.text6,'String', 'Outer radius:');

r1=set(handles.text7,'String', 'Inner radius:');

get(handles.edit1,'double')

get(handles.edit2,'double')

get(handles.edit3,'double')

case 'Parabolic'

set(handles.text5,'String','Diameter:');

set(handles.text6,'String', 'Length:');

set(handles.text7,'String', '')

get(handles.edit1,'String')

get(handles.edit2,'String')

handles.D= str2double(get(handles.edit1,'String'));

handles.L= str2double(get(handles.edit2,'String'));

m=((4*h)/(k*D)).^0.5;

handles.C1= 1+2*((D/L).^2);

handles.C2=(1+((D/L).^2)).^0.5;

Areafin=str2double(((pi*L.^3)/(8*D))*((C1*C2)-(L/2*D)*(log((2*D*C2/L)+C1))));

Finefficiency= str2double((2/(1+(((2*m*L/3).^2)+1).^0.5)));

end

------------------------- Here is the code for the push button

function pushbutton1_Callback(hObject, eventdata, handles)

set(handles.text10, 'double', Areafin)

set(handles.text11, 'Double',Finefficiency)

Explanation / Answer

A=get(hObject,'String');

switch A

case 'Aluminum'

handle.h=set(handles.text2,'String', 'h= 35 W/m2.K');

handle.k=set(handles.text3,'String', 'k= 205 W/m.k ');

h=35;

k=205;

case 'Copper'

set(handles.text2, 'String', 'h= 120 W/m2.K');

set(handles.text3,'String', 'k= 385 W/m.K ');

case 'Stainless steel'

set(handles.text2,'String','h= 25 W/m2.K');

set(handles.text3,'String', 'k= 50.2 W/m.K');

end

function uipanel4_SelectionChangeFcn(hObject, eventdata, handles)

B=get(hObject,'String');

switch B

case 'Rectangular';

L=set(handles.text5,'String','Length');

w=set(handles.text6,'String', 'Width:');

t=set(handles.text7,'String', 'Thickness:');

get(handles.edit1,'String')

get(handles.edit2,'String')

get(handles.edit3,'double')

h=set(handles.text2,'String');

k=set(handles.text3,'String');

m=((2*h)/(k*t)).^0.5;

L_c=L+(t/2);

Areafin=str2double(2*w*L_c);

Finefficiency= str2double(tanh(m*L_c)/(m*L_c));

case 'Annular'

t=set(handles.text5,'String','Thickness:');

r2=set(handles.text6,'String', 'Outer radius:');

r1=set(handles.text7,'String', 'Inner radius:');

get(handles.edit1,'double')

get(handles.edit2,'double')

get(handles.edit3,'double')

case 'Parabolic'

set(handles.text5,'String','Diameter:');

set(handles.text6,'String', 'Length:');

set(handles.text7,'String', '')

get(handles.edit1,'String')

get(handles.edit2,'String')

handles.D= str2double(get(handles.edit1,'String'));

handles.L= str2double(get(handles.edit2,'String'));

m=((4*h)/(k*D)).^0.5;

handles.C1= 1+2*((D/L).^2);

handles.C2=(1+((D/L).^2)).^0.5;

Areafin=str2double(((pi*L.^3)/(8*D))*((C1*C2)-(L/2*D)*(log((2*D*C2/L)+C1))));

Finefficiency= str2double((2/(1+(((2*m*L/3).^2)+1).^0.5)));

end

------------------------- Here is the code for the push button

function pushbutton1_Callback(hObject, eventdata, handles)

set(handles.text10, 'double', Areafin)

set(handles.text11, 'Double',Finefficiency)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote