Студопедия

Главная страница Случайная страница

КАТЕГОРИИ:

АвтомобилиАстрономияБиологияГеографияДом и садДругие языкиДругоеИнформатикаИсторияКультураЛитератураЛогикаМатематикаМедицинаМеталлургияМеханикаОбразованиеОхрана трудаПедагогикаПолитикаПравоПсихологияРелигияРиторикаСоциологияСпортСтроительствоТехнологияТуризмФизикаФилософияФинансыХимияЧерчениеЭкологияЭкономикаЭлектроника






Код файла MOD_PZ_ST.m






function varargout = MOD_PZ_ST(varargin)

% MOD_PZ_ST M-file for MOD_PZ_ST.fig

% MOD_PZ_ST, by itself, creates a new MOD_PZ_ST or raises the existing

% singleton*.

%

% H = MOD_PZ_ST returns the handle to a new MOD_PZ_ST or the handle to

% the existing singleton*.

%

% MOD_PZ_ST('CALLBACK', hObject, eventData, handles,...) calls the local

% function named CALLBACK in MOD_PZ_ST.M with the given input arguments.

%

% MOD_PZ_ST('Property', 'Value',...) creates a new MOD_PZ_ST or raises the

% existing singleton*. Starting from the left, property value pairs are

% applied to the GUI before MOD_PZ_ST_OpeningFunction gets called. An

% unrecognized property name or invalid value makes property application

% stop. All inputs are passed to MOD_PZ_ST_OpeningFcn via varargin.

%

% *See GUI Options on GUIDE's Tools menu. Choose " GUI allows only one

% instance to run (singleton)".

%

% See also: GUIDE, GUIDATA, GUIHANDLES

 

% Copyright 2002-2003 The MathWorks, Inc.

 

% Edit the above text to modify the response to help MOD_PZ_ST

 

% Last Modified by GUIDE v2.5 16-Apr-2014 15: 45: 49

 

% Begin initialization code - DO NOT EDIT

gui_Singleton = 1;

gui_State = struct('gui_Name', mfilename,...

'gui_Singleton', gui_Singleton,...

'gui_OpeningFcn', @MOD_PZ_ST_OpeningFcn,...

'gui_OutputFcn', @MOD_PZ_ST_OutputFcn,...

'gui_LayoutFcn', [],...

'gui_Callback', []);

if nargin & & ischar(varargin{1})

gui_State.gui_Callback = str2func(varargin{1});

end

 

if nargout

[varargout{1: nargout}] = gui_mainfcn(gui_State, varargin{: });

else

gui_mainfcn(gui_State, varargin{: });

end

% End initialization code - DO NOT EDIT

 

 

% --- Executes just before MOD_PZ_ST is made visible.

function MOD_PZ_ST_OpeningFcn(hObject, eventdata, handles, varargin)

% This function has no output args, see OutputFcn.

% hObject handle to figure

% Choose default command line output for MOD_PZ_ST

handles.output = hObject;

 

% Update handles structure

guidata(hObject, handles);

 

% UIWAIT makes MOD_PZ_ST wait for user response (see UIRESUME)

% uiwait(handles.figure1);

set(handles.figure1, 'Name', 'ПЛАНОВАЯ ЗАДАЧА MOD_PZ_ST')

 

global interp_type

interp_type = 'linear';

set(handles.bt_INTERPOL, 'String', 'linear')

dir *.txt

% --- Outputs from this function are returned to the command line.

function varargout = MOD_PZ_ST_OutputFcn(hObject, eventdata, handles)

% varargout cell array for returning output args (see VARARGOUT);

% hObject handle to figure

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

 

% Get default command line output from handles structure

varargout{1} = handles.output;

 

 

% --- Executes on button press in START.

% function START_Callback(hObject, eventdata, handles)

% --- Executes on button press in pb2_START2.

 

function pb2_START2_Callback(hObject, eventdata, handles)

% hObject handle to pb2_START2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

global interp_type

%interp_type = 'linear';

%_______________________________________________________

clc

dir *.txt

% disp(handles)

%dialog

%msgbox

%winmenu

%inputdlg

Sech(1).name=get(handles.sech1, 'String');

Sech(2).name=get(handles.sech2, 'String');

Sech(3).name=get(handles.sech3, 'String');

Sech(4).name=get(handles.sech4, 'String');

Sech(5).name=get(handles.sech5, 'String');

Sech(6).name=get(handles.sech6, 'String');

Sech(7).name=get(handles.sech7, 'String');

 

S_MAX=7;

for n=1: S_MAX

Sech(n).name;

end

% Name_Uch= ['RES_' Sech(1).name '_' Sech(2).name '.txt'];

% % set(handles.txt_Name_Uch, 'String', Name_Uch);

% Data_Uch =csvread(Name_Uch);

% SIZ_Uch= size(Data_Uch);

%

% Numm_elem_Uch=numel(Data_Uch);

% S1 = Data_Uch(1,:);

% S2 = Data_Uch(2,:);

% S3 = Data_Uch(3,:);

% B_H = S1(1, 1); OMEGA_H =S1(1, 2); T_SRED_H = S1(1, 3);

% B_K = S2(1, 1); OMEGA_K =S2(1, 2); T_SRED_K = S2(1, 3);

% SREZKA_H= S3(1, 1); SREZKA_K = S3(1, 2); SHEROX= S3(1, 3);

% DISTANT =S3(1, 4); F = S3(1, 5);

% %set(handles.ed_MODULF, 'String', num2str(F));

 

 

%___________ Чтение файлов линий тока ____________

 

for m=1: S_MAX-1

Name_Tok= ['TOK_' Sech(m).name '_' Sech(m+1).name '.txt'];

% Name_Tok= 'TOK_TeST1_TeST2.txt'

Data_Tok =csvread(Name_Tok);

SIZ_Tok= size(Data_Tok);

Numm_elem_Tok=numel(Data_Tok);

arBH(m).Tok = Data_Tok(1,:);

arBK(m).Tok = Data_Tok(3,:);

end

NQ= length(arBH(1).Tok)-1;

set(handles.ed_N, 'String', num2str(NQ));

% arBH

% arBH.Tok

% arBK.Tok

%___________ Матрица линий тока ____________

 

for m=1: S_MAX-1

LinSech(m).Tok = arBH(m).Tok;

end

LinSech(S_MAX).Tok = arBK(S_MAX-1).Tok;

 

for k=1: NQ+1

for r=1: S_MAX

LinTok(r, k)= LinSech(r).Tok(k);

end

end

LinTok';

size(LinTok);

 

%-------------- X Координаты сечений

axes(handles.axesH);

cla; hold on

grid on

%------------- DIST

% DIST= [0 100 200 300 400 500 600]

DST(1) = str2double(get(handles.ed_D1, 'String'));

DST(2) = str2double(get(handles.ed_D2, 'String'));

DST(3) = str2double(get(handles.ed_D3, 'String'));

DST(4) = str2double(get(handles.ed_D4, 'String'));

DST(5) = str2double(get(handles.ed_D5, 'String'));

DST(6) = str2double(get(handles.ed_D6, 'String'));

DST(7) = str2double(get(handles.ed_D7, 'String'));

DIST = DST;

%-------------Y Береговой линии

REL(1) = str2double(get(handles.ed_R1, 'String'));

REL(2) = str2double(get(handles.ed_R2, 'String'));

REL(3) = str2double(get(handles.ed_R3, 'String'));

REL(4) = str2double(get(handles.ed_R4, 'String'));

REL(5) = str2double(get(handles.ed_R5, 'String'));

REL(6) = str2double(get(handles.ed_R6, 'String'));

REL(7) = str2double(get(handles.ed_R7, 'String'));

REL;

% size(REL)

M_REL=[REL; REL; REL; REL; REL; REL; REL; REL; REL; REL; REL]';

size(M_REL);

 

state= get(handles.check1, 'Value'); % wiev line

if state==0 NN=NQ+1;

else NN=1;

end

 

%----------- Вывод линий тока (линейный)----------

 

if strcmp(interp_type, 'linear')

for k=1: S_MAX-1

for n=NN: NQ+1

if (n==1)|(n==NQ+1)

Col= 'black'; LW=3;

else Col= 'blue'; LW = 2;

end

line([DIST(k) DIST(k+1)], [arBH(k).Tok(n)+REL(k)...

arBK(k).Tok(n)+REL(k+1)],...

'LineWidth', LW, 'Color', Col)

end

end

line([DIST], [REL], 'LineWidth', 4, 'Color', 'black')

end

 

% AA = [arBH.Tok];

% AA1 =[arBH(1).Tok];

%----------- Вывод линий тока (сплайн)----------

 

LSS =LinTok+M_REL;

plt=0.01; % шаг plot

if strcmp(interp_type, 'cubic')

for m=NN: NQ+1

X=DIST;

Y= LSS(:, m);

XX=DIST(1): plt*DIST(end): DIST(end);

YY= spline(X, Y, XX);

 

if(m==1) | (m==NQ+1)

Col='black'; LW =4;

else Col='blue'; LW = 2;

end

%plot(X, Y, 'o', XX, YY, '-', 'LineWidth', 2, 'Color', Col, 'LineWidth', LW)

plot(XX, YY, '-', 'LineWidth', 2, 'Color', Col, 'LineWidth', LW)

end

X=DIST;

Y= LSS(:, 1);

XX=DIST(1): plt*DIST(end): DIST(end);

YY= spline(X, Y, XX);

plot(XX, YY, '-', 'LineWidth', 2, 'Color', Col, 'LineWidth', LW)

 

end

%_________________________________________________________

%---------------------- CHESI

Q = str2double(get(handles.ed_Q, 'String'));

F = str2double(get(handles.ed_MODULF, 'String'));

DZ = Q^2*F;

set(handles.ed_DZ, 'String', num2str(DZ));

DISTANT = DIST(end);

UKLON = (DZ/DISTANT)*1000;

set(handles.ed_UKLON, 'String', num2str(UKLON));

DQ = Q/NQ;

set(handles.ed_DQ, 'String', num2str(DQ));

 

 

% --- Executes on button press in bt_INTERPOL.

function bt_INTERPOL_Callback(hObject, eventdata, handles)

% hObject handle to bt_INTERPOL (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hint: get(hObject, 'Value') returns toggle state of bt_INTERPOL

 

global interp_type

button_state = get(hObject, 'Value');

if button_state == get(hObject, 'Max')

% peressed

interp_type = 'linear';

set(handles.bt_INTERPOL, 'String', 'linear')

elseif button_state == get(hObject, 'Min')

% not peressed

interp_type = 'cubic';

set(handles.bt_INTERPOL, 'String', 'cubic')

end

pb2_START2_Callback(handles.pb2_START2, eventdata, handles)

 

% --- Executes on button press in check1.

function check1_Callback(hObject, eventdata, handles)

pb2_START2_Callback(handles.pb2_START2, eventdata, handles)

 

%+++++++++++++++++ END PROGRAM TEXT ++++++++++++++++++++++++

function ed_SREZKA_Callback(hObject, eventdata, handles)

% Hints: get(hObject, 'String') returns contents of ed_SREZKA as text

% str2double(get(hObject, 'String'))returns contents of ed_SREZKA as a double

 

function sech2_Callback(hObject, eventdata, handles)

 

function ed_DISTANT_Callback(hObject, eventdata, handles)

 

function ed_SHEROX_Callback(hObject, eventdata, handles)

 

function ed_MODULF_Callback(hObject, eventdata, handles)

 

function sech1_Callback(hObject, eventdata, handles)

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject, 'String') returns contents of sech1 as text

% str2double(get(hObject, 'String')) returns contents of sech1 as a double

% name = 'S1L.txt'

% nameH = get(hObject, 'String')

% DAT =csvread(nameH)

% ------------------------ CREATE FUNCTIONS

% --- Executes during object creation, after setting all properties.

function ed_MODULF_CreateFcn(hObject, eventdata, handles)

% hObject handle to ed_MODULF (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.

% See ISPC and COMPUTER.

if ispc & & isequal(get(hObject, 'BackgroundColor'),...

get(0, 'defaultUicontrolBackgroundColor'))

set(hObject, 'BackgroundColor', 'white');

end

% --- Executes during object creation, after setting all properties.

function ed_SHEROX_CreateFcn(hObject, eventdata, handles)

 

if ispc & & isequal(get(hObject, 'BackgroundColor'),...

get(0, 'defaultUicontrolBackgroundColor'))

set(hObject, 'BackgroundColor', 'white');

end

% --- Executes during object creation, after setting all properties.

function ed_DISTANT_CreateFcn(hObject, eventdata, handles)

 

if ispc & & isequal(get(hObject, 'BackgroundColor'),...

get(0, 'defaultUicontrolBackgroundColor'))

set(hObject, 'BackgroundColor', 'white');

end

 

% --- Executes during object creation, after setting all properties.

function sech2_CreateFcn(hObject, eventdata, handles)

 

if ispc & & isequal(get(hObject, 'BackgroundColor'),...

get(0, 'defaultUicontrolBackgroundColor'))

set(hObject, 'BackgroundColor', 'white');

end

 

% --- Executes during object creation, after setting all properties.

function ed_SREZKA_CreateFcn(hObject, eventdata, handles)

 

if ispc & & isequal(get(hObject, 'BackgroundColor'),...

get(0, 'defaultUicontrolBackgroundColor'))

set(hObject, 'BackgroundColor', 'white');

end

 

% --- Executes during object creation, after setting all properties.

function sech1_CreateFcn(hObject, eventdata, handles)

 

if ispc & & isequal(get(hObject, 'BackgroundColor'),...

get(0, 'defaultUicontrolBackgroundColor'))

set(hObject, 'BackgroundColor', 'white');

end

 

function Sech3_Callback(hObject, eventdata, handles)

% hObject handle to Sech3 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject, 'String') returns contents of Sech3 as text

% str2double(get(hObject, 'String')) returns contents of Sech3 as a double

% --- Executes during object creation, after setting all properties.

function Sech3_CreateFcn(hObject, eventdata, handles)

if ispc & & isequal(get(hObject, 'BackgroundColor'),...

get(0, 'defaultUicontrolBackgroundColor'))

set(hObject, 'BackgroundColor', 'white');

end

function sech4_Callback(hObject, eventdata, handles)

% hObject handle to sech4 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject, 'String') returns contents of sech4 as text

%str2double(get(hObject, 'String')) returns contents of sech4 as a double

% --- Executes during object creation, after setting all properties.

function sech4_CreateFcn(hObject, eventdata, handles)

if ispc & & isequal(get(hObject, 'BackgroundColor'),...

get(0, 'defaultUicontrolBackgroundColor'))

set(hObject, 'BackgroundColor', 'white');

end

 

function sech5_Callback(hObject, eventdata, handles)

 

% Hints: get(hObject, 'String') returns contents of sech5 as text

% str2double(get(hObject, 'String')) returns contents of sech5 as a double

% --- Executes during object creation, after setting all properties.

function sech5_CreateFcn(hObject, eventdata, handles)

 

if ispc & & isequal(get(hObject, 'BackgroundColor'),...

get(0, 'defaultUicontrolBackgroundColor'))

set(hObject, 'BackgroundColor', 'white');

end

 

function edit10_Callback(hObject, eventdata, handles)

 

% --- Executes during object creation, after setting all properties.

function edit10_CreateFcn(hObject, eventdata, handles)

 

if ispc & & isequal(get(hObject, 'BackgroundColor'),...

get(0, 'defaultUicontrolBackgroundColor'))

set(hObject, 'BackgroundColor', 'white');

end

function sech6_Callback(hObject, eventdata, handles)

 

% --- Executes during object creation, after setting all properties.

function sech6_CreateFcn(hObject, eventdata, handles)

if ispc & & isequal(get(hObject, 'BackgroundColor'),...

get(0, 'defaultUicontrolBackgroundColor'))

set(hObject, 'BackgroundColor', 'white');

end

 

function ed_DQ_Callback(hObject, eventdata, handles)

% Hints: get(hObject, 'String') returns contents of ed_DQ as text

%str2double(get(hObject, 'String')) returns contents of ed_DQ as a double

 

% --- Executes during object creation, after setting all properties.

function ed_DQ_CreateFcn(hObject, eventdata, handles)

if ispc & & isequal(get(hObject, 'BackgroundColor'),...

get(0, 'defaultUicontrolBackgroundColor'))

set(hObject, 'BackgroundColor', 'white');

end

 

function ed_R_GIDRO_K_Callback(hObject, eventdata, handles)

 

% --- Executes during object creation, after setting all properties.

function ed_R_GIDRO_K_CreateFcn(hObject, eventdata, handles)

if ispc & & isequal(get(hObject, 'BackgroundColor'),...

get(0, 'defaultUicontrolBackgroundColor'))

set(hObject, 'BackgroundColor', 'white');

end

 

function ed_K_RASX_K_Callback(hObject, eventdata, handles)

 

% --- Executes during object creation, after setting all properties.

function ed_K_RASX_K_CreateFcn(hObject, eventdata, handles)

 

if ispc & & isequal(get(hObject, 'BackgroundColor'),...

get(0, 'defaultUicontrolBackgroundColor'))

set(hObject, 'BackgroundColor', 'white');

end

 

function edit14_Callback(hObject, eventdata, handles)

 

% --- Executes during object creation, after setting all properties.

function edit14_CreateFcn(hObject, eventdata, handles)

 

if ispc & & isequal(get(hObject, 'BackgroundColor'),...

get(0, 'defaultUicontrolBackgroundColor'))

set(hObject, 'BackgroundColor', 'white');

end

 

 

function ed_K_RASX_H_Callback(hObject, eventdata, handles)

 

 

% --- Executes during object creation, after setting all properties.

function ed_K_RASX_H_CreateFcn(hObject, eventdata, handles)

 

if ispc & & isequal(get(hObject, 'BackgroundColor'),...

get(0, 'defaultUicontrolBackgroundColor'))

set(hObject, 'BackgroundColor', 'white');

end

 

function ed_C_K_Callback(hObject, eventdata, handles)

% hObject handle to ed_C_K (see GCBO)

 

% --- Executes during object creation, after setting all properties.

function ed_C_K_CreateFcn(hObject, eventdata, handles)

if ispc & & isequal(get(hObject, 'BackgroundColor'),...

get(0, 'defaultUicontrolBackgroundColor'))

set(hObject, 'BackgroundColor', 'white');

end

 

function ed_C_H_Callback(hObject, eventdata, handles)

 

% --- Executes during object creation, after setting all properties.

function ed_C_H_CreateFcn(hObject, eventdata, handles)

 

if ispc & & isequal(get(hObject, 'BackgroundColor'),...

get(0, 'defaultUicontrolBackgroundColor'))

set(hObject, 'BackgroundColor', 'white');

end

 

 

function ed_Q_Callback(hObject, eventdata, handles)

 

 

% --- Executes during object creation, after setting all properties.

function ed_Q_CreateFcn(hObject, eventdata, handles)

 

 


Поделиться с друзьями:

mylektsii.su - Мои Лекции - 2015-2024 год. (0.051 сек.)Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав Пожаловаться на материал