



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




[V, E] = eig(A) with MATLAB
Eigenvectors: V = [ 0-0.7071i 0+0.7071i
0.7071 0.7071]
Eigenvalues: E =[ 0.4000 + 0.6000i 0
0 0.4000 - 0.6000i]
BxC=[-3 6 -3] A.BxC = 0
AxB=[-3 6 -3] AxB.C = 0
i) AB x BC = [-1 1 -1] x [0 -1 1] = [0 1 1] Therefore, ax + by + cz + d =0 is y+z+d=0. With point A(1, 0, 1), d= -1. Equation is y+z-1=0.
ii) line L is x=y=z, therefore the intersection is (0.5, 0.5, 0.5).
char s="Hello!"; char t[6]; char p, q; p=s; q=t; for (;q++ = *p++;);
Correction:
**char *s="Hello!"; char t[7]; char p, q; p=s; q=t; for (;q++ = p++;);
1.431000 0.505000 0. 1.572000 0.505000 0. 1.287000 0.505000 0. 1.431000 0.505000 0.
I also plotted it in Matlab. First I wrote a program to reformat the data as 3 files: x.dat, y.dat, z.dat.
// Time-stamp: </wrf/graphics/hw1/refmt.cc, Mon, 24 Jan 2005, 16:01:51 EST, wrf AT ecse.rpi.edu>
// reformat ncc1701.data to be useful for Matlab fill3.
// W. Randolph Franklin
#include
using namespace std; using boost::array;
typedef array<double,3> Tpoint;
int main() {
Tpoint p; vector
vector
string files[3]={"x.dat","y.dat","z.dat"};
ifstream instream("ncc1701.data"); if (!instream) { cout << "ERROR: can't open file ncc1701.data" << endl; exit(1); }
while (instream >> p[0] >> p[1] >> p[2]) { n++; indata.push_back(p); }
int m=indata.size();
if (m%4 !=0) { cerr << "ERROR number of points is not a multiple of 4." << endl; exit(1); }
for (int xyz=0; xyz<3; xyz++) { ofstream outstream(files[xyz].c_str()); if (!outstream) { cout << "ERROR: can't open output file" << endl; exit(1); } for (int k=0; k<3; k++) { for (int j=0; j<m; j+=4) outstream << indata[j+k][xyz] << ' '; outstream << endl; } } }
Then I did this in Matlab:
load 'x.dat';