Finding the x interval for when a function is less than another

2 visualizzazioni (ultimi 30 giorni)
PJ il 23 Gen 2018
Risposto: Jordy Jose il 31 Gen 2018
I plotted two functions 'phi' and 'RHS' and I am trying to figure out how to find the x intervals for when 'phi' is less than or equal to 'RHS'. Is there a simple code that would directly give me the x intervals and possibly highlight them on the plot.
clear all;
clc;
x=-1:0.01:5;
y=x.*(x-2).*(x-4).^2;
dy=4*x.^3-30*x.^2+64*x-32;
a=0:0.01:5;
phi= a.^4 - 10.*a.^3 +32.*a.^2 -38.*a+15;
dphi=4.*a.^3 -30.*a.^2 +64.*a -38;
c1=0.01;
figure(1)
plot(x,y)
RHS= 15 - c1.*a.*38;
figure(2)
plot(a,phi,a,RHS)
0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Risposte (1)

Jordy Jose il 31 Gen 2018
Hello,
To find the intervals of x where 'phi' is less than or equal to 'RHS', you may use "find" function. For example:
>>inds = find(phi <= RHS);
>>a(inds)
0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Categorie

Scopri di più su Annotations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by