which block to use for feedback loop in simulink

5 views (last 30 days)
where x0=initial value,,,and x value should be updated continuously ,,this I wanted to implement in simulink,,,and I have developed this with using "unit delay" block,,,but for further am changing some values of equation run time ,,,that time my "unit delay" block is starting calculation again from the initial value,,,rather i want my unit delay to take value of present calculated x value,,,,,,,,or anybody can suggest which is the best block to use for feedback loop,ehich takes initial value from defined value and next value from the feedback loop

Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 15 Jan 2013
Both Unit delay and Memory blocks work fine.
Arun Badigannavar
Arun Badigannavar on 16 Jan 2013
function pushbutton3_Callback(hObject,eventdata)
f441= figure('MenuBar','none','Position', [550,500,300,140],'Name','Position Update','NumberTitle','off','color',[0.933 0.835 0.835]);
% push button for editing values of speed and course of firing platform
PB31= uicontrol('Style','pushbutton','String','Firing Platform','Position',[10,80,90,25],'FontAngle','italic','Callback',{@pushbutton212_Callback});
% push button for editing values of speed and course of Target platform
PB32= uicontrol('Style','pushbutton','String','Target Platform','Position',[150,80,90,25],'FontAngle','italic','Callback',{@pushbutton222_Callback});
%%%%%To display a course and speed of user defined values
% This push buttons callback for Firing platform
function pushbutton212_Callback(hObject,eventdata)
prompt = {'Enter Course:', 'Enter Speed:'};
title = 'Course&Speed';
lines = 1;
def = {'Course', 'Speed'};
answer = inputdlg(prompt, title, lines, def);
[Course_F Speed_F]= answer{:} %Put the user entered value in a structure course and speed
w=str2num(Course_F); %Convert string entered to numeric type
c=num2cell(w); %Convert numeric to cell type
d=cell2mat(c); %Convert from cell to matrix format
e=str2num(Speed_F);%Convert string entered to numeric type
f=num2cell(e); %Convert numeric to cell type
h=cell2mat(f); %Convert from cell to matrix format
assignin('base','Course_F',d);%assign the value of course to workspace
assignin('base','Speed_F',h)%assign the speed value to the workspace
set_param('C:\Documents and Settings\admin\Desktop\New Folder (5)\02_12_2012(Simulink blocks)\Resolved Models\Speed+Position+Course\course_speed_position.mdl', 'SimulationCommand','update')

Sign in to comment.


Find more on Programmatic Model Editing in Help Center and File Exchange



Community Treasure Hunt

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

Start Hunting!