Simple Data Analysis
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello everyone!
I have two simple questions in data analysis:
1) I have z, a 17*1 matrix, for each value of z, I want to find B (another 17*1 matrix) according to the code:
u0 = pi*4E-7;
N = 300;
I = 1;
L = 160E-3;
b = 16.5E-3;
a = z + L/2;
c = z - L/2;
B = (u0*N*I/2*L)*((a/sqrt(b^2 + a^2))- (c/sqrt(b^2 + c^2)));
Now, I will get the error:
??? Error using ==> mpower
Matrix must be square.
so, I change it to a.^ and c.^, but now I will get B as 17*17 matrix and this is not what I need. How can I find B once for each value of z (like we do in Excel).
2) Second question:
I have x = Ay , if I have -for example- experimental values of x and y I got it from an experiment and plot the points and I want to compare them with the theoretical line. How can I plot the the theoretical line on top of the Experimental values on the same graph (Note: x first have discrete specific values, and now I want x for example like: 5:0.01:10) ?
Sorry for the bad English..
0 Kommentare
Akzeptierte Antwort
Laura Proctor
am 22 Nov. 2011
1) Array-wise division ./ Without it, you are solving the equation A*x = b for A with "matrix division" (A = b/x) so that if x and b are both 17x1, then A will be a 17x17 matrix. Using the dot-notation creates an element by element division.
B = (u0*N*I/2*L)*((a./sqrt(b^2 + a^.2))- (c./sqrt(b^2 + c.^2)));
2) Plotting... does A define your parameter values? If so, then this code should do it.
plot(x,y,'k.')
xt = 5:0.01:10;
yt = A\xt;
hold all
plot(xt,yt,'r')
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Digital Filter Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!