Borrar filtros
Borrar filtros

How do can I solve for 2 unknowns in one equation given a data set for x and y.

1 visualización (últimos 30 días)
The equation is (A/2)*[1+(alpha/2)+cos(2*pi*x)-(alpha/4)*cos(4*pi*x)]:
I need to solve for A and alpha, given 50 points for x and y:
x = [0, 0.013824885, 0.034562212, 0.057603687, 0.073732719, 0.094470046, 0.119815668, 0.142857143, 0.168202765, 0.188940092, 0.198156682, 0.223502304, 0.246543779, 0.264976959, 0.274193548, 0.290322581, 0.299539171, 0.315668203, 0.331797235, 0.359447005, 0.380184332, 0.398617512, 0.421658986, 0.447004608, 0.474654378, 0.497695853, 0.525345622, 0.525345622, 0.548387097, 0.571428571, 0.599078341, 0.629032258, 0.652073733, 0.665898618, 0.68202765, 0.695852535, 0.711981567, 0.730414747, 0.748847926, 0.767281106, 0.783410138, 0.797235023, 0.813364055, 0.841013825, 0.866359447, 0.882488479, 0.896313364, 0.914746544 ,0.928571429, 0.958525346];
y = [0.002808989, 0.008426966, 0.019662921, 0.030898876, 0.047752809, 0.06741573, 0.098314607, 0.146067416, 0.188202247, 0.22752809, 0.25, 0.303370787, 0.342696629, 0.379213483, 0.390449438, 0.401685393, 0.412921348, 0.424157303, 0.424157303, 0.426966292, 0.424157303, 0.424157303, 0.415730337, 0.407303371, 0.401685393, 0.398876404, 0.401685393, 0.401685393, 0.407303371, 0.41011236, 0.421348315, 0.426966292, 0.429775281, 0.429775281, 0.424157303, 0.415730337, 0.398876404, 0.379213483, 0.345505618, 0.311797753, 0.278089888, 0.25, 0.216292135, 0.162921348, 0.115168539, 0.087078652, 0.070224719, 0.050561798, 0.033707865, 0.016853933];

Respuestas (2)

the cyclist
the cyclist el 27 de Ag. de 2013
Having plotted (x,y), I'm guessing that the answer to Walter's question is that you want a single best-fit equation to those points.
If you have the Statistics Toolbox, you can do that with the nlinfit() function.
doc nlinfit
for details.
Also, if you search this forum on "cyclist" and "nlinfit", you should be able to find a couple examples I have posted here.

SooShiant
SooShiant el 20 de Feb. de 2014
Here is a simple example which you can change the equation and range and solve yours. The equation is 12x+9y+7z-60=0 where x,y,z are integers varies 0 to 10:
x=[0:1:10];
y=[0:1:10];
z=[0:1:10];
[X,Y,Z]=ndgrid(x,y,z);
F=12.*X+9.*Y+7.*Z-60;
idx=find(F==0);
[X(idx(:)),Y(idx(:)),Z(idx(:))];
Equations of this type are known as Diophantine equations.

Categorías

Más información sobre Quadratic Programming and Cone Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by