Simple question: How to find the 'x' at a certain value of y(x) equation?
Show older comments
This may be a simple question. But let's assume I have one ugly equation:
x = [0:10];
y = @(x) x.^2.*12./23./23.9.*log(x).^2
How do I find the value of 'x' where y = 30?
Thanks!
4 Comments
Ishank Gupta
on 28 Mar 2019
I am new to matlab and in general coding.
I was writing a code for taylors series in matlab so I thought what if i input the function from user itself and the solve for that. But to do that i need to find the function value at x=0, How should i proceed with this.(just curious)
Thanks a lot..
Dyuman Joshi
on 11 Oct 2023
Moved: Sam Chak
on 11 Oct 2023
Did you tried the approach that is mentioned in the accepted answer?
@Ceylin, Which intersection do you want to solve for x?
syms f(x)
f(x) = sin(x);
fplot(f, [-2*pi, 2*pi]), grid on % draw left side of Eqn
yline(0.2, 'r-') % draw right side of Eqn
xlabel('x')
legend('sin(x)', '0.2')
Accepted Answer
More Answers (1)
Alpha
If you plot the following
x=[-100:.1:100]
f = @(x) x.^2.*12./23./23.9.*log(x).^2
y=f(x)
plot(x,y)
grid on
place the marker on the point that shows y=30 f(x) is not symmetric, it has 2 zeros, and f=30 on 2 places:
x01=14.04
x02=-29.5
if what you really mean is:
f2 = @(x) x.^2.*12./(23.*23.9).*log(abs(x)).^2
then the function is symmetric and there are 2 values of x that satisfy your question:
x01=14.04
x02=-14.04
Compare both functions and y=30

If you find this answer of any help solving this question, please click on the thumbs-up vote link
thanks in advance
John
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
