Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Visualization of angles and amplitude of magnetic field lines with quiver
- % and contour
- % made by Samuel Schmidt
- % this file needs two matrices: winkel/spannungen(with the same dimensions)
- % imported into the workspace of matlab
- % excel --> csv --> "Home"-Tab: "Import Data": "Numeric Matrix" + rename
- %
- % radians converter
- r = 0.0174533;
- w = zeros(36, 49);
- s = zeros(36, 49);
- % our excel was constructed upside down kinda so we have to flip the
- % matrices (note this step might be unnecessary/needs to be changed,
- % depending on the imported data)
- for i = 1:size(winkel,2)
- for j = 0:size(winkel,1)-1
- w(36-j,i) = winkel(j+1,i);
- end
- end
- for i = 1:size(spannungen,2)
- for j = 0:size(spannungen,1)-1
- s(36-j,i) = spannungen(j+1,i);
- end
- end
- % for some reason the angles are inverted, so we turn them back
- w = w + 180;
- % these two lines are basically from the quiver doc
- % but with a radians conversion with r*w
- u = cos(r*w);
- v = sin(r*w);
- quiver(u,v)
- % hold allows us to plot two plots on top of each other in a quick way
- hold on;
- % http://matlab.izmiran.ru/help/techdoc/ref/colormap.html
- colormap('jet')
- % one can possibly set the line "levels" themselves
- contour(s)
- hold off
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement