Azzera filtri
Azzera filtri

Plotting multiple functions getting an error

2 visualizzazioni (ultimi 30 giorni)
Connor LeClaire
Connor LeClaire il 16 Gen 2022
Modificato: Connor LeClaire il 16 Gen 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.

Risposte (1)

Image Analyst
Image Analyst il 16 Gen 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 Commento
Connor LeClaire
Connor LeClaire il 16 Gen 2022
Modificato: Connor LeClaire il 16 Gen 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].

Accedi per commentare.

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by