Plot two grafphs at the same figure

조회 수: 1 (최근 30일)
Lucas Neves
Lucas Neves 2016년 12월 26일
댓글: KSSV 2016년 12월 27일
First of all: Merry Xmas and happy holidays to all!
Now here's my doubt: I want to plot two graphs at the same figure. But, each graph has it own program. Example: I have the program1 with the graph1 and the program2 with the graph2. Both graphs has the same x and y labels. I think that the solution may be using the savefig and the openfig commands but i didn't have sucess using both..
Thanks in advance!

채택된 답변

KSSV
KSSV 2016년 12월 26일
You have to read about hold on
clc; clear all
x = linspace(-pi,pi);
y1 = sin(x);
y2 = cos(x);
plot(x,y1)
hold on
plot(x,y2)
xlabel('x-axes')
ylabel('y-axes')
  댓글 수: 2
Lucas Neves
Lucas Neves 2016년 12월 26일
I got that mate. But after i use the "hold on" how can i plot the second graph if it's from another file and i only have the .fig file from it?
KSSV
KSSV 2016년 12월 27일
Hold on works on .fig too. You read the data from the file and plot it.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by