フィルターのクリア

How to show two plots on same graph?

1 回表示 (過去 30 日間)
Ismaeel Dasti
Ismaeel Dasti 2018 年 11 月 26 日
コメント済み: Ismaeel Dasti 2018 年 11 月 26 日
I am reading 2 sets of data from my computer and would like to show the plots for both sets of data on one graph. I am using the hold on command but the plots still show on separate graphs. How can I fix this? Code shown below.
clear all; close all; clc; format compact
% Define parameters of circuit
R = 100e3 % Update according to resistor used in circuit
C = 10e-6
tau = R*C
% Load in data
% OPTION 1: If loading file from your local machine:
% A = csvread('data.csv',2,1);
% OPTION 2: If using MATLAB via Virtual Computing Lab, identify folder on your laptop:
A = csvread('data4.csv',3,1);
A2 = csvread('data3.csv',3,1);
% Extract and assign data
V1 = A(:,1);
V2 = A(:,2);
t = A(:,3);
V3 = A2(:,1);
V4 = A2(:,2);
t2 = A2(:,3);
% Plot data
figure(1);hold on
plot(t,V1,'r','LineWidth',4)
plot(t,V2,'g','LineWidth',4)
hold on
figure(2);hold on
plot(t2,V3,'b','LineWidth',4)
plot(t2,V4,'c','LineWidth',4)
title('Title here');
grid minor
legend('V1','V2','Location','NorthEast')
title('Analysis of RC Circuit Data')
xlabel('Time [sec]')
ylabel('ADC Code')
  1 件のコメント
madhan ravi
madhan ravi 2018 年 11 月 26 日
so upload your csv files

サインインしてコメントする。

回答 (1 件)

madhan ravi
madhan ravi 2018 年 11 月 26 日
An example:
plot(x,y)
hold on
plot(x1,y1)
  1 件のコメント
Ismaeel Dasti
Ismaeel Dasti 2018 年 11 月 26 日
just uploaded thd csv files

サインインしてコメントする。

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by