Plotting multiple functions getting an error

2 visualizaciones (últimos 30 días)
Connor LeClaire
Connor LeClaire el 16 de En. de 2022
Editada: Connor LeClaire el 16 de En. de 2022
Hello,
I am trying to plot a function and a piecewise function on the same subplot but the second (piecewise) function is not plottedand I keep getting the error:
Warning: Error updating FunctionLine.
DataSpace or ColorSpace transform method failed.
%Edited for clarity
syms w real;
clc;
phase = atand(w/3)+atand(w/5)-90+atand(-w/2)+atand(-w/4); %1st equation
pPhase = piecewise(w<0.2,-90); %2nd equation (currently a test function, but full version will span 0.01→1000), must be piecewise
figure();
fplot(phase,[0.01, 1000]);
set(gca,'Xscale','log')
hold on;
fplot(pPhase);
I would like to plot both functions on the same graph.

Respuestas (1)

Image Analyst
Image Analyst el 16 de En. de 2022
If you don't use syms and fplot(), you can do this:
numPoints = 2000;
w = linspace(0, 1000, numPoints);
phase = atand(w/3)+atand(w/5)-90+atand(-w/2)+atand(-w/4);
plot(w, phase, '-');
set(gca,'Xscale','log')
but what is your second function and over what range does it apply to?
  1 comentario
Connor LeClaire
Connor LeClaire el 16 de En. de 2022
Editada: Connor LeClaire el 16 de En. de 2022
It is the piecewise function 'pPhase' (3rd line from the bottom in my code). Currently just a test function, but it will apply exactly to the plotted range [0.01, 1000].

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by