Simple Data Analysis

조회 수: 2 (최근 30일)
Abdullah
Abdullah 2011년 11월 22일
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..

채택된 답변

Laura Proctor
Laura Proctor 2011년 11월 22일
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개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by