im using the bode() function, it automatically assigns a title to the plot, how do i add to this title without overwriting it in matlab

You can add to the existing title of the plot generated with bode() by using the title() function. Here's an example:

main.m
sys = tf([1],[1 1]);
bode(sys);
% Get the current title of the plot
curr_title = get(get(gca,'Title'),'String');
% Add some text to the title
new_title = [curr_title, ' with added text'];
title(new_title);
206 chars
8 lines

This code gets the current title of the plot using get(gca,'Title'), which returns the handle to the title text object. It then appends some text to the title string and sets the title to the new string using title(new_title).

Alternatively, you can also use the suptitle() function from the Matlab File Exchange to add a centered title above the entire figure (including all subplots) rather than the individual subplot title.

main.m
sys = tf([1],[1 1]);
bode(sys);
% Add a centered title above the figure
suptitle('Title above all subplots');
110 chars
5 lines

related categories

gistlibby LogSnag