Plot two grafphs at the same figure

4 ビュー (過去 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 Center および File ExchangePrinting and Saving についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by