Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

need help with program wrote script but its not totally right

5 vues (au cours des 30 derniers jours)
Cory
Cory le 13 Fév 2012
Clôturé : MATLAB Answer Bot le 20 Août 2021
The data files contain in the first column a distance to travel and in the second column a direction. heading the direction headings are given as referenced to a clock face.
The pattern begins at the origin of a Cartesian coordinate system with the person facing 12 o’clock, see the figure below. The figure shows an example of the first step in the pattern being a distance of 1.5 feet in the direction of 7 o’clock. All direction headings are given in terms of this clock orientation.
The distance values given are in feet.
Write a script file that will allow the user to input from the
keyboard the filename of the file that they wish to analyze. Load
only that data file and plot the resulting pattern.
Defined to occur at the coordinate location corresponding to (average x, average y). When plotting the resulting pattern on the Cartesian coordinate system, set the axes limits appropriately.
file_1 = x column(distance) 1.2,1.6,1.2,1.6,1.2
y column(clock face) 9,12,3,12,9
% This program determines patterns by (x,y) coordinates that are
% calculated with given data
clear,clc
filename=input('Enter file name in quotes');
data=load(filename);
data(:,2)=clock;
angle=rem((60 - (clock - 1) * 30) + 360, 360);
angle=theta;
data(:,1)=hypotenuse;
h=hypotenuse;
x=cos(theta)*h;
y=sin(theta)*h;
disp('plot(x,y)')
disp('xlabel')
disp('ylabel')
disp('title')
disp('grid')
fprintf('%3.2f %2.1e %9.13f\n',[plot(x,y)])
Im new to matlab so this
  3 commentaires
Cory
Cory le 14 Fév 2012
Problems:
1.my data(:,2) and data (:,3) functions arent reading files right. Ive tried making numerous files but non work.
2.When I enter a file it reads an error "index exceeds matrix dimensions"
3. im not sure how to show "theta"
Walter Roberson
Walter Roberson le 14 Fév 2012
You need to show us _exactly_ what an input file looks like. For example you cannot use "load" if the file has commas.

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by