write code that shows a tree when i run the code in matlab

main.m
% Create a basic tree structure
tree = {[0,0], {[1,1], [2,1]}, {[-1,2], [0,2]}, {[0,2], [1,2]}};

% Plot the tree structure
figure;
hold on;
plot([0,0], [0,0], 'ko'); % Trunk

for i=1:numel(tree)
    branches = tree{i};
    for j=1:numel(branches)
        plot([tree{i}{1}(1), branches{j}(1)], [tree{i}{1}(2), branches{j}(2)], 'b-');
    end
end

axis equal;
359 chars
17 lines

related categories

gistlibby LogSnag