2 variables symbolic function representation
1 view (last 30 days)
Show older comments
Hello everyone!
I need to represent a two variables function.
From the following determinant
A =
I obtained the quadratic equation:
a =
These are the vectors p and q:
p00 = 0.909722222222223
p10 = -0.233216488601376
p01= 0.264523899711384
p20=-1.06968750000000
p11=-0.0207056503962889
p02=0.578645833333333
q00=0.907638888888890
q10=0.00799330706899891
q01=0.0257069830283098
q20=0.0382031250000013
q11=0.0414113007925775
q02=-0.628619791666669
I want to impose the function a ==0 and in order to obtain the curve and then I would like to represent it in a graph.
Is there a way to do it?
I used ht = matlabFunction(a) to obtain
ht = function_handle with value:
@(p01,p02,p10,p11,p20,q01,q10,q11,q20,x,y)(p20.*q11.*2.0-p11.*q20.*2.0).*x.^2+(p20.*q20.*4.0-p02.*q20.*4.0).*x.*y+(p10.*q11-p01.*q20.*2.0-p11.*q10+p20.*q01.*2.0).*x+(p11.*q20.*2.0-p02.*q11.*2.0).*y.^2+(p11.*q01-p02.*q10.*2.0-p01.*q11+p10.*q20.*2.0).*y+(p10.*q01-p01.*q10)
I don't understand if it is useful.
Thank you very much!
Laura
0 Comments
Answers (1)
VBBV
on 16 May 2024
Hi @laura bagnale, you can use the function handle and choose a suitable plot function for representation that best fits your needs
p00 = 0.909722222222223;
p10 = -0.233216488601376;
p01= 0.264523899711384;
p20=-1.06968750000000;
p11=-0.0207056503962889;
p02=0.578645833333333;
q00=0.907638888888890;
q10=0.00799330706899891;
q01=0.0257069830283098;
q20=0.0382031250000013;
q11=0.0414113007925775;
q02=-0.628619791666669;
%using function handle
a = @(x,y)(p20.*q11.*2.0-p11.*q20.*2.0).*x.^2+(p20.*q20.*4.0-p02.*q20.*4.0).*x.*y+(p10.*q11-p01.*q20.*2.0-p11.*q10+p20.*q01.*2.0).*x+(p11.*q20.*2.0-p02.*q11.*2.0).*y.^2+(p11.*q01-p02.*q10.*2.0-p01.*q11+p10.*q20.*2.0).*y+(p10.*q01-p01.*q10)
f = a([-5:5],[-5:5]) % give the range of values for x
% example 1
plot(f)
%example 2
[X,Y] = meshgrid(linspace(-5,5,50),linspace(-5,5,50));
surf(X,Y,a(X,Y))
0 Comments
See Also
Categories
Find more on Least Squares 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!