Search Results

Search found 1051 results on 43 pages for 'matlab'.

Page 24/43 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Matlab code help. Backward Euler method.

    - by m0s
    Here is the matlab/freemat code I got to solve ODE numerically using backward Euler method. However the results are inconsistent with my textbook results, and sometimes even ridiculously inconsistent. Please point out what is wrong with the code. I have already asked this question on mathoverflow.com no help there, hope someone here can help. function [x,y]=backEuler(f,xinit,yinit,xfinal,h) %f - this is your y prime %xinit - initial X %yinit - initial Y %xfinal - final X %h - step size n=(xfinal-xinit)/h; %Calculate steps %Inititialize arrays... %1st elements take xinit and yinit corespondigly, the rest fill with 0s x=[xinit zeros(1,n)]; y=[yinit zeros(1,n)]; %Numeric routine for i=1:n x(i+1)=x(i)+h; ynew=y(i)+h*(f(x(i),y(i))); y(i+1)=y(i)+h*f(x(i+1),ynew); end end

    Read the article

  • MATLAB: How do I get 3D coordiantes from a user-click?

    - by John
    I'm using Matlab to create a small chess game for one of my courses this semester. The thing I'm having trouble with is having the user be able to select one of the chess pieces. To simplify things, I'm making it so that the user selects a piece by clicking on the square that the chess piece resides on rather than clicking the piece itself (which I assume would be much more difficult). I know how to get the x and y coordinates of the view-port, but how do I transform these coordinates into 3-space coordinates? I know that there are multiple x,y,z coordinates associated with each view-port coordinate, but I'm only interested in the x,y,z coordinate where z = 0 (since the board itself is in the x,y plane that intersects the z axis where z = 0). Thanks!

    Read the article

  • How to make a random number generator in matlab that is based on percentages?

    - by Ben Fossen
    I am currently using the built in random number generator. for example nAsp = randi([512, 768],[1,1]); 512 is the lower bound and 768 is the upper bound, the random number generator chooses a number from between these two values. What I want is to have two ranges for nAsp but I want one of them to get called 25% of the time and the other 75% of the time. Then gets plugged into he equation. Does anyone have any ideas how to do this or if there is a built in function in matlab already? for example nAsp = randi([512, 768],[1,1]); gets called 25% of the time nAsp = randi([690, 720],[1,1]); gets called 75% of the time

    Read the article

  • MATLAB: How do I get 3D coordiantes from a user-click?

    - by Tim
    I'm using Matlab to create a small chess game for one of my courses this semester. The thing I'm having trouble with is having the user be able to select one of the chess pieces. To simplify things, I'm making it so that the user selects a piece by clicking on the square that the chess piece resides on rather than clicking the piece itself (which I assume would be much more difficult). I know how to get the x and y coordinates of the view-port, but how do I transform these coordinates into 3-space coordinates? I know that there are multiple x,y,z coordinates associated with each view-port coordinate, but I'm only interested in the x,y,z coordinate where z = 0 (since the board itself is in the x,y plane that intersects the z axis where z = 0). Thanks!

    Read the article

  • Why i get this following error when using dir in Matlab?

    - by nata
    Matlab keep give me following error message : ??? Error using == dir Argument must contain a string. Error in == Awal at 15 x = dir(subDirs) Below is my codes : %MY PROGRAM clear all; clc; close all; %-----Create Database----- TrainDB = uigetdir('','Select Database Directory'); TrainFiles = dir(TrainDB); dirIndex = [TrainFiles.isdir]; [s subDirNumber] = size(dirIndex); for i = 3:subDirNumber subDirs = {TrainFiles(i).name}; subDirs = strcat(TrainDB,'\',subDirs); x = dir(subDirs) %<-------Error Here end Is something wrong with the codes? Your help will be appreciated. I'm sorry for my bad English.

    Read the article

  • How do I create efficient instance variable mutators in Matlab?

    - by Trent B
    Previously, I implemented mutators as follows, however it ran spectacularly slowly on a recursive OO algorithm I'm working on, and I suspected it may have been because I was duplicating objects on every function call... is this correct? %% Example Only obj2 = tripleAllPoints(obj1) obj.pts = obj.pts * 3; obj2 = obj1 end I then tried implementing mutators without using the output object... however, it appears that in MATLAB i can't do this - the changes won't "stick" because of a scope issue? %% Example Only tripleAllPoints(obj1) obj1.pts = obj1.pts * 3; end For application purposes, an extremely simplified version of my code (which uses OO and recursion) is below. classdef myslice properties pts % array of pts nROW % number of rows nDIM % number of dimensions subs % sub-slices end % end properties methods function calcSubs(obj) obj.subs = cell(1,obj.nROW); for i=1:obj.nROW obj.subs{i} = myslice; obj.subs{i}.pts = obj.pts(1:i,2:end); end end function vol = calcVol(obj) if obj.nROW == 1 obj.volume = prod(obj.pts); else obj.volume = 0; calcSubs(obj); for i=1:obj.nROW obj.volume = obj.volume + calcVol(obj.subs{i}); end end end end % end methods end % end classdef

    Read the article

  • Is there any function in Matlab for changing the form of matrix?

    - by niko
    Hi, I have to get the unknown matrix by changing the form of known matrix considering the following rules: H = [-P'|I] G = [I|P] where H is known matrix G is unknown matrix which has to be calculated I is identity matrix So for example if we had a matrix H = [1 1 1 1 0 0; 0 0 1 1 0 1; 1 0 0 1 1 0] its form has to be changed to H = [1 1 1 1 0 0; 0 1 1 0 1 0; 1 1 0 0 0 1] so -P' = [1 1 1; 0 1 0; 1 1 0] and in case of binary matrices -P = P therefore G = [1 0 0 1 1 1; 0 1 0 0 1 0; 0 0 1 1 1 0] I know how to solve it on the paper by performing basic row operations but don't know how if there is any function already written in Matlab to calculate G from H or H from G by considering the above rules. I would be very thankful if anyone of you could suggest any method for solving the given problem. Thank you.

    Read the article

  • Update on: How to model random non-overlapping spheres of non-uniform size in a cube using Matlab?

    - by user3838079
    I am trying to use MATLAB for generating random locations for non-uniform size spheres (non-overlapping) in a cube. The for loop in the code below never seems to end. I don't know what am missing in the code. I have ran the code for no. of spheres (n) = 10; dims = [ 10 10 10 ] function [ c r ] = randomSphere( dims ) % creating one sphere at random inside [0..dims(1)]x[0..dims(2)]x... % radius and center coordinates are sampled from a uniform distribution % over the relevant domain. % output: c - center of sphere (vector cx, cy,... ) % r - radius of sphere (scalar) r = rand(1); % you might want to scale this w.r.t dims or other consideration c = r + rand( size(dims) )./( dims - 2*r ); % make sure sphere does not exceed boundaries function ovlp = nonOverlapping( centers, rads ) % check if several spheres with centers and rads overlap or not ovlp = false; if numel( rads ) == 1 return; % nothing to check for a single sphere end dst = sqrt( sum( bsxfun( @minus, permute( centers, [1 3 2] ),... permute( centers, [3 1 2] ) ).^2, 3) ); ovlp = dst >= bsxfun( @plus, rads, rads.' ); %' all distances must be smaller than r1+r2 ovlp = any( ovlp(:) ); % all must not overlap function [centers rads] = sampleSpheres( dims, n ) % dims is assumed to be a row vector of size 1-by-ndim % preallocate ndim = numel(dims); centers = zeros( n, ndim ); rads = zeros( n, 1 ); ii = 1; while ii <= n [centers(ii,:), rads(ii) ] = randomSphere( dims ); if nonOverlapping( centers(1:ii,:), rads(1:ii) ) ii = ii + 1; % accept and move on end end

    Read the article

  • Better code for accessing fields in a matlab structure array?

    - by John
    I have a matlab structure array Modles1 of size (1x180) that has fields a, b, c, ..., z. I want to understand how many distinct values there are in each of the fields. i.e. max(grp2idx([foo(:).a])) The above works if the field a is a double. {foo(:).a} needs to be used in the case where the field a is a string/char. Here's my current code for doing this. I hate having to use the eval, and what is essentially a switch statement. Is there a better way? names = fieldnames(Models1); for ix = 1 : numel(names) className = eval(['class(Models1(1).',names{ix},')']); if strcmp('double', className) || strcmp('logical',className) eval([' values = [Models1(:).',names{ix},'];']); elseif strcmp('char', className) eval([' values = {Models1(:).',names{ix},'};']); else disp(['Unrecognized class: ', className]); end % this line requires the statistics toolbox. [g, gn, gl] = grp2idx(values); fprintf('%30s : %4d\n',names{ix},max(g)); end

    Read the article

  • MATLAB: What is an appropriate Data Structure for a Matrix with Random Variable Entries?

    - by user568249
    I'm currently working in an area that is related to simulation and trying to design a data structure that can include random variables within matrices. To motivate this let me say I have the following matrix: [a b; c d] I want to find a data structure that will allow for a, b, c, d to either be real numbers or random variables. As an example, let's say that a = 1, b = -1, c = 2 but let d be a normally distributed random variable with mean 0 and SD 1. The data structure that I have in mind will give no value to d. However, I also want to be able to design a function that can take in the structure, simulate an uniform(0,1), obtain a value for d using an inverse CDF and then spit out an actual matrix. I have several ideas to do this (all related to the MATLAB icdf function) but would like to know how more experienced programmers would do this. In this application, it's important that the structure is as "lean" as possible since I will be working with very very large matrices and memory will be an issue.

    Read the article

  • LaTeX-like display programming environment

    - by Gage
    I used to be a hobbyist programmer, but now I'm also a fairly experienced physicist and find myself programming to solve certain problems quite a lot. In physics, we use variables with superscripts, subscripts, italics, underlines, etc etc. To bridge this gap to the computer we usually use LaTeX. Now, I generally use MATLAB for handling any data and such, and find it very irritating that I can't basically use LaTeX for variable names. Something as simple as sy has to be named either sigma_y or some descriptive name like peak_height_error. I don't necessarily want full on workable LaTeX in my code, but I do want to be able to use greek letters and super/sub-scripts at the very least. Does this exist?

    Read the article

  • What languages are most commonly used in medical research?

    - by Chris Taylor
    For someone about to go into a career in medical research, what language would be the most useful to learn? From my limited experience (I have been a researcher in mathematics and in finance) I have been able to recommend looking at R (for statistics) Matlab (for general numeric processing) and Python (for general purpose programming with statistics/numerics as an add-on) but I don't know which of those (if any) are in common use -- or if there are other, more specialized languages that are used. To be clear, I'm not talking about a professional programmer working in a medical setting. I am talking about a medical or genetics researcher who uses programming to analyse data, or generally to help get their work done.

    Read the article

  • Matlab wont extract first row & column because of matrix dimensions !

    - by ZaZu
    Hey guys, I am tracking an object that is thrown in air, and this object governs a parabolic pattern. Im tracking the object through a series of 30 images. I managed to exclude all the background and keep the object apparent, then used its centroid to get its coordinates and plot them. Now im supposed to predict where the object is going to fall, so I used polyfit & polyval .. the problem is, matlab says ??? Index exceeds matrix dimensions. Now the centroid creates its own structure with a row and 2 columns. Everytime the object moves in the loop, it updates the first row only .. Here is part of the code : For N=1:30 . . . x=centroid(1,1); % extract first row and column for x y=centroid(1,2); % extract secnd row and column for x plot_xy=plot(x,y) set(plot_xy,'XData',x(1:N),'YData',y(1:N)); fitting=polyfit(x(1:N),y(1:N),2); parabola=plot(x,nan(23,1)); evaluate=polyval(fitting,x); set(parabola,'YData',evaluate) . . end The error message I get is ??? Index exceeds matrix dimensions. It seems that (1:N) is causing the problems .. I honestly do not know why .. But when I remove N, the object is plotted along with its points, but polyfitting wont work, it gives me an error saying : Warning: Polynomial is not unique; degree >= number of data points. > In polyfit at 72 If I made it (1:N-1) or something, it plots more points before it starts giving me the same error (not unique ...) . Any ideas why ?? Thanks alot !!

    Read the article

  • How to read and save data from text file with variable number of columns in a Matrix in Matlab

    - by khan
    I have a text file with integer values. each row contains information about specific object. But unfortunately each row has different number of column. because of which when i try to use file_content = load('txtfile.txt'); it gives me error message that previous number of columns does not match. i also tried to use fgetl, fscanf, etc function but was unsuccessful. Can anybody give me a piece of code, or help me how to read a txt file and save in matrix in matlab. Three sample rows are given below. 1 1 1 1 1 95 17 54 111 92 17 54 111 92 17 54 111 92 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 54 109 92 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 58 109 96 15 58 109 96 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 58 109 96 15 56 109 94 15 56 109 94 15 58 109 96 15 58 109 96 15 56 109 94 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 17 58 111 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 56 109 94 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 1 1 1 2 96 185 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 15 56 109 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 54 107 92 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 54 109 92 15 54 109 92 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 1 1 1 3 186 245 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 13 58 107 96 13 56 107 94 13 56 107 94 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 56 107 94 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 60 107 98 13 58 107 96 13 58 107 96 15 58 109 96 13 58 107 96 As you can see the rows doesn't have equal number of columns. So how can i read and save it in a Matrix. Any help in this regards will be highly appreciated. Thanks

    Read the article

  • R.matlab/readMat : Error in readTag(this)

    - by Megan
    I am trying to read a matlab file into R using R.matlab but am encountering this error: require(R.matlab) r <- readMat("file.mat", verbose=T) Trying to read MAT v5 file stream... Error in readTag(this) : Unknown data type. Not in range [1,19]: 18569 In addition: Warning message: In readMat5Header(this, firstFourBytes = firstFourBytes) : Unknown MAT version tag: 512. Will assume version 5. How can this issue be solved or is there an alternative way to load matlab files? I can use hdf5load but have heard this can mess with the data. Thanks!

    Read the article

  • Drawing random smooth lines contained in a square [migrated]

    - by Doug Mercer
    I'm trying to write a matlab function that creates random, smooth trajectories in a square of finite side length. Here is my current attempt at such a procedure: function [] = drawroutes( SideLength, v, t) %DRAWROUTES Summary of this function goes here % Detailed explanation goes here %Some parameters intended to help help keep the particles in the box RandAccel=.01; ConservAccel=0; speedlimit=.1; G=10^(-8); % %Initialize Matrices Ax=zeros(v,10*t); Ay=Ax; vx=Ax; vy=Ax; x=Ax; y=Ax; sx=zeros(v,1); sy=zeros(v,1); % %Define initial position in square x(:,1)=SideLength*.15*ones(v,1)+(SideLength*.7)*rand(v,1); y(:,1)=SideLength*.15*ones(v,1)+(SideLength*.7)*rand(v,1); % for i=2:10*t %Measure minimum particle distance component wise from boundary %for each vehicle BorderGravX=[abs(SideLength*ones(v,1)-x(:,i-1)),abs(x(:,i-1))]'; BorderGravY=[abs(SideLength*ones(v,1)-y(:,i-1)),abs(y(:,i-1))]'; rx=min(BorderGravX)'; ry=min(BorderGravY)'; % %Set the sign of the repulsive force for k=1:v if x(k,i)<.5*SideLength sx(k)=1; else sx(k)=-1; end if y(k,i)<.5*SideLength sy(k)=1; else sy(k)=-1; end end % %Calculate Acceleration w/ random "nudge" and repulive force Ax(:,i)=ConservAccel*Ax(:,i-1)+RandAccel*(rand(v,1)-.5*ones(v,1))+sx*G./rx.^2; Ay(:,i)=ConservAccel*Ay(:,i-1)+RandAccel*(rand(v,1)-.5*ones(v,1))+sy*G./ry.^2; % %Ad hoc method of trying to slow down particles from jumping outside of %feasible region for h=1:v if abs(vx(h,i-1)+Ax(h,i))<speedlimit vx(h,i)=vx(h,i-1)+Ax(h,i); elseif (vx(h,i-1)+Ax(h,i))<-speedlimit vx(h,i)=-speedlimit; else vx(h,i)=speedlimit; end end for h=1:v if abs(vy(h,i-1)+Ay(h,i))<speedlimit vy(h,i)=vy(h,i-1)+Ay(h,i); elseif (vy(h,i-1)+Ay(h,i))<-speedlimit vy(h,i)=-speedlimit; else vy(h,i)=speedlimit; end end % %Update position x(:,i)=x(:,i-1)+(vx(:,i-1)+vx(:,i))/2; y(:,i)=y(:,i-1)+(vy(:,i-1)+vy(:,1))/2; % end %Plot position clf; hold on; axis([-100,SideLength+100,-100,SideLength+100]); cc=hsv(v); for j=1:v plot(x(j,1),y(j,1),'ko') plot(x(j,:),y(j,:),'color',cc(j,:)) end hold off; % end My original plan was to place particles within a square, and move them around by allowing their acceleration in the x and y direction to be governed by a uniformly distributed random variable. To keep the particles within the square, I tried to create a repulsive force that would push the particles away from the boundaries of the square. In practice, the particles tend to leave the desired "feasible" region after a relatively small number of time steps (say, 1000)." I'd love to hear your suggestions on either modifying my existing code or considering the problem from another perspective. When reading the code, please don't feel the need to get hung up on any of the ad hoc parameters at the very beginning of the script. They seem to help, but I don't believe any beside the "G" constant should truly be necessary to make this system work. Here is an example of the current output: Many of the vehicles have found their way outside of the desired square region, [0,400] X [0,400].

    Read the article

  • How do I shrink a matrix using an array mask in MATLAB?

    - by Pyrolistical
    This seems to be a very common problem of mine: data = [1 2 3; 4 5 6]; mask = [true false true]; mask = repmat(mask, 2, 1); data(mask) ==> [1; 4; 3; 6] What I wanted was [1 3; 4 6]. Yes I can just reshape it to the right size, but that seems the wrong way to do it. Is there a better way? Why doesn't data(mask) return a matrix when it is actually rectangular? I understand in the general case it may not be, but in my case since my original mask is an array it always will be. Corollary Thanks for the answer, I just also wanted to point out this also works with anything that returns a numeric index like ismember, sort, or unique. I used to take the second return value from sort and apply it to every column manually when you can use this notion to do it one shot.

    Read the article

  • How do I translate this Matlab bsxfun call to R?

    - by claytontstanley
    I would also (fingers crossed) like the solution to work with R Sparse Matrices in the Matrix package. >> A = [1,2,3,4,5] A = 1 2 3 4 5 >> B = [1;2;3;4;5] B = 1 2 3 4 5 >> bsxfun(@times, A, B) ans = 1 2 3 4 5 2 4 6 8 10 3 6 9 12 15 4 8 12 16 20 5 10 15 20 25 >> EDIT: I would like to do a matrix multiplication of these sparse vectors, and return a sparse array: > class(NRowSums) [1] "dsparseVector" attr(,"package") [1] "Matrix" > class(NColSums) [1] "dsparseVector" attr(,"package") [1] "Matrix" > NRowSums * NColSums (I think) w/o using a non-sparse variable to temporarily store data.

    Read the article

  • High volume SVM (machine learning) system

    - by flyingcrab
    I working on a possible machine learning project that would be expected to do high speed computations for machine learning using SVM (support vector machines) and possibly some ANN. I'm resonably comfortable working on matlab with these, but primarly in small datasets, just for experimentation. I'm wondering if this matlab based approach will scale? or should i be looking into something else? C++ / gpu based computing? java wrapping of the matlab code and pushing it onto app engine? Incidentally, there seems to be a lot fo literature on GPUs, but not much on how useful they are on machine learning applications using matlab, & the cheapest CUDA enlabled GPU money can buy? is it even worth the trouble?

    Read the article

  • Psychology researcher wants to learn new language

    - by user273347
    I'm currently considering R, matlab, or python, but I'm open to other options. Could you help me pick the best language for my needs? Here are the criteria I have in mind (not in order): Simple to learn. I don't really have a lot of free time, so I'm looking for something that isn't extremely complicated and/or difficult to pick up. I know some C, FWIW. Good for statistics/psychometrics. I do a ton of statistics and psychometrics analysis. A lot of it is basic stuff that I can do with SPSS, but I'd like to play around with the more advanced stuff too (bootstrapping, genetic programming, data mining, neural nets, modeling, etc). I'm looking for a language/environment that can help me run my simpler analyses faster and give me more options than a canned stat package like SPSS. If it can even make tables for me, then it'll be perfect. I also do a fair bit of experimental psychology. I use a canned experiment "programming" software (SuperLab) to make most of my experiments, but I want to be able to program executable programs that I can run on any computer and that can compile the data from the experiments in a spreadsheet. I know python has psychopy and pyepl and matlab has psychtoolbox, but I don't know which one is best. If R had something like this, I'd probably be sold on R already. I'm looking for something regularly used in academe and industry. Everybody else here (including myself, so far) uses canned stat and experiment programming software. One of the reasons I'm trying to learn a programming language is so that I can keep up when I move to another lab. Looking forward to your comments and suggestions. Thank you all for your kind and informative replies. I appreciate it. It's still a tough choice because of so many strong arguments for each language. Python - Thinking about it, I've forgotten so much about C already (I don't even remember what to do with an array) that it might be better for me to start from scratch with a simple program that does what it's supposed to do. It looks like it can do most of the things I'll need it to do, though not as cleanly as R and MATLAB. R - I'm really liking what I'm reading about R. The packages are perfect for my statistical work now. Given the purpose of R, I don't think it's suited to building psychological experiments though. To clarify, what I mean is making a program that presents visual and auditory stimuli to my specifications (hundreds of them in a preset and/or randomized sequence) and records the response data gathered from participants. MATLAB - It's awesome that cognitive and neuro folk are recommending MATLAB, because I'm preparing for the big leap from social and personality psychology to cognitive neuro. The problem is the Uni where I work doesn't have MATLAB licenses (and 3750 GBP for a compiler license is not an option for me haha). Octave looks like a good alternative. PsychToolbox is compatible with Octave, thankfully. SQL - Thanks for the tip. I'll explore that option, too. Python will be the least backbreaking and most useful in the short term. R is well suited to my current work. MATLAB is well suited to my prospective work. It's a tough call, but I think I am now equipped to make a more well-informed decision about where to go next. Thanks again!

    Read the article

  • How do I draw a texture-mapped triangle in MATLAB?

    - by Petter
    I have a triangle in (u,v) coordinates in an image. I would like to draw this triangle at 3D coordinates (X,Y,Z) texture-mapped with the triangle in the image. Here, u,v,X,Y,Z are all vectors with three elements representing the three corners of the triangle. I have a very ugly, slow and unsatisfactory solution in which I (1) extract a rectangular part of the image, (2) transform it to 3D space with the transformation defined by the three points, (3) draw it with surface, and (4) finally masking out everything that is not part of the triangle with AlphaData. Surely there must be an easier way of doing this?

    Read the article

  • How do I make matlab legends match the colour of the graphs?

    - by Alex Gosselin
    Here is the code I used: x = linspace(0,2); e = exp(1); lin = e; quad = e-e.*x.*x/2; cub = e-e.*x.*x/2; quart = e-e.*x.*x/2+e.*x.*x.*x.*x/24; act = e.^cos(x); mplot = plot(x,act,x,lin,x,quad,x,cub,x,quart); legend('actual','linear','quadratic','cubic','quartic') This produces a legend matching the right colors to actual and linear, then after that it seems to skip over red on the graph, but not on the legend, i.e. the legend says quadratic should be red, but the graph shows it as green, the legend says cubic should be green, but the graph shows it as purple etc. Any help is appreciated.

    Read the article

  • How to strink matrix using array mask in Matlab?

    - by Pyrolistical
    This seems to be a very common problem of mine. data = [1 2 3; 4 5 6]; mask = [true false true]; mask = repmat(mask, 2, 1); data(mask) ==> [1; 4; 3; 6] What I wanted was [1 3; 4 6] Yes I can just reshape it to the right size, but that seems the wrong way to do it. Is there a better way? Why doesn't data(mask) return a matrix when it is actually rectangular? I understand in the general case it may not be, but in my case since my original mask is an array it always will be.

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >