Hi all, I want to get values from user for 4 parameters, then place them into the second part of the code.
% Callback function
function LengthEditFieldValueChanged(app, event) global L value = app.LengthEditField.Value; L = value; end % Callback function function DiameterEditFieldValueChanged(app, event) global D value1 = app.DiameterEditField.Value; D = value1; end % Callback function function RPMEditFieldValueChanged(app, event) global n value3 = app.RPMEditField.Value; n = value3; end % Callback function function reciprocatingtimesEditFieldValueChanged(app, event) global S value4 = app.reciprocatingtimesEditField.Value; S = value4; end
2nd part of the question
function ButtonPushed(app, event) global a global V_f global L global S global n global D a = 10;V_f = 15; x = 1:50; %diameter
y = 1:50; %length
V_w = (V_f * pi * D * n)/(2*L*S);for i = 1:length(y) hor(i) = V_w * sqrt(2*y(i)/a); i = i+1;endplot(y,hor, 'r')hold onfor i=1:100; k = y - i; plot(k, hor, 'r') hold on m = -x - i; plot(m, hor, 'b') hold on i= i +1;end end end
Best Answer