How do I combine multiple plots in one graph?
1.401 views (last 30 days)
Hi, is there somewhere I can see some examples of scripts that result in multiple plots on one graph?
I know the 'hold' function is part of how to do it, but I'm very new to Matlab and I really need to see some full examples.
If someone could point me towards some that'd be great.
More Answers (7)
N Narayan rao on 25 Sep 2016
Edited: Walter Roberson on 15 Jul 2017
x = -3:0.1:3;
y1 = sin(x);
y2 = cos(x);
Raghuram on 27 Mar 2014
Could you please tell me the same with scatter plot command? That is, to plot multiple scatter plots in one figure?
Emil Latypov on 16 Apr 2020
Edited: Image Analyst on 16 Apr 2020
In chemistry, the pH of an aqueous solution is a measure of its acidity. The pH scale ranges from 0 to 14, inclusive. A solution with a pH of 7 is said to be neutral, a solution with a pH greater than 7 is basic, and a solution with a pH less than 7 is acidic.
I did it, but my prof said it is not professional. How to do it professionally?
%% Chapter 8 Question 19
%% This script cteats the a vector structure mysol with various solutions
%% and their pH-values and adds another field mysol.acidity.
mysol(3) = struct('name','bleach','pH',12);
mysol(1) = struct('name','juce','pH',5);
mysol(2) = struct('name','milk','pH',7);
acidity = myacidity(mysol);
for i = 1:3
mysol(i).acidity = strcat(acidity(i,:));
function acidity = myacidity(mysol)
% This function receives a vector structure with various solutions and
% their pH-values and determines acidity of solutions.
len = length(mysol);
acidity(len,:) = blanks(7);
for i = 1:len
if mysol(i).pH < 7
acidity(i,:) = 'acidic ';
elseif mysol(i).pH > 7
acidity(i,:) = 'basic ';
acidity(i,:) = 'neutral';