# I want to know the value of x for each value of V

2 views (last 30 days)
Pablo Zarco on 10 Feb 2021
Commented: Cris LaPierre on 10 Feb 2021
V=[2,4,5,6,7]
for i=1:numel(V)
x(i)=(2+4*7+8-9*6+x(i))/(3+4*6*V(i)+3*x(i))
end
##### 2 CommentsShowHide 1 older comment
Pablo Zarco on 10 Feb 2021
Is an equation with one variable. The thing is that I would like to know if there is a way to solve this without clearing the x

Cris LaPierre on 10 Feb 2021
Edited: Cris LaPierre on 10 Feb 2021
You are using x to calculate x. This is causing an error since x doesn't exist yet.
What is the equation you are trying to implement in MATLAB?
##### 2 CommentsShowHide 1 older comment
Cris LaPierre on 10 Feb 2021
V=[2,4,5,6,7];
fp=fplot(@(x)(2+4*7+8-9*6+x)./(3+4*6*V+3*x))
fp =
5×1 FunctionLine array: FunctionLine FunctionLine FunctionLine FunctionLine FunctionLine
legend("V="+num2str(V'))
Use the plot object to get the x and y data of each line. For example
x1 = fp(1).XData
x1 = 1×45
-5.0000 -4.7914 -4.5455 -4.3075 -4.0909 -3.8679 -3.6364 -3.3856 -3.1818 -2.9285 -2.7273 -2.5080 -2.2727 -2.0542 -1.8182 -1.5647 -1.3636 -1.1199 -0.9091 -0.6699 -0.4545 -0.2294 0 0.2273 0.4545 0.6909 0.9091 1.1546 1.3636 1.5870
y1 = fp(1).YData
y1 = 1×45
-0.5833 -0.5677 -0.5499 -0.5333 -0.5188 -0.5043 -0.4898 -0.4746 -0.4627 -0.4484 -0.4374 -0.4257 -0.4136 -0.4027 -0.3912 -0.3793 -0.3702 -0.3594 -0.3503 -0.3403 -0.3315 -0.3226 -0.3137 -0.3052 -0.2969 -0.2885 -0.2809 -0.2726 -0.2657 -0.2585

R2020b

### Community Treasure Hunt

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

Start Hunting!