I have data for nine participants and four different variables (Right Knee, Left Knee, Right Ankle and Left Ankle) which I have imported into matlab.

I want to find the maximum value for each variable and each participant. I have written the following script:

for joint_num = 1:4

```
if joint_num == 1
joint = 'LAnkle';
elseif joint_num == 2
joint = 'RAnkle';
elseif joint_num == 3
joint = 'LKnee';
elseif joint_num == 4
joint = 'RKnee';
File = ['TorqueData_',joint,'_Isom'];
MaxT = max (TorqueData_LAnkle_Isom);
MaxT = max (TorqueData_RAnkle_Isom);
MaxT = max (TorqueData_LKnee_Isom);
MaxT = max (TorqueData_RKnee_Isom);
end
```

end

However, when I run the script, instead of getting a table of four rows and nine columns with the maximum values of each variable, I get one row of nine columns, with the maximum values of the last variable (RKnee).

I'm sure this is something simple but I am new to matlab and really struggling! If anyone could helpt it would be very much appreciated.

Thanks and Best Wishes

]]>I am a mathematician. I have to write a matlab or octave function: function(m)=multsines(f1,f2)

which calculates the mean, m, of the product of the two sine with frequencies f_1,f_2, and plots the product in a figure.

Any help?

Thanks!

]]>code is given below.

[FileName,PathName] = uigetfile('

I = double(imread([PathName '\' FileName]));

% normalize between 0 and 255

bw=~im2bw(I,0.5); %Threshold and invert

subplot(1,2,1), imshow(bw,[]);

[y,x]=find(bw>0.5); %Get coordinates of non zero pixels

centroid=mean([x y]); %Get (centroid) of data

hold on; plot(centroid(1),centroid(2),'rd'); %Plot shape centroid

C=cov([x y]); %Calculate covariance of coordinates

[U,S]=eig(C)

m=U(2,1)./U(1,1);

const=centroid(2)/m.

xl=50:450; yl=m.

subplot(1,2,2), h1=line(xl,yl); %Display image and axes

set(h,'Color',[1 0 0],'LineWidth',2.0)

m2=U(2,2)./U(1,2);

const=centroid(2)/m2.

x2=50:450; y2=m2.*x2+const

h2=line(x2,y2);

set(h,'Color',[1 0 0], 'LineWidth',2.0), ]]>

clc

msg_orig(1)=0;

msg_orig(2)=1;

msg_orig(3)=0;

msg_orig(4)=0;

msg_orig(5)=1;

msg_orig(6)=0;

msg_orig(7)=1;

msg_orig(8)=1;

msg_orig(9)=0;

msg_orig(10)=0;

msg_orig(11)=0;

msg_orig(12)=1;

msg_orig(13)=0;

msg_orig(14)=0;

msg_orig(15)=1;

msg_orig(16)=0;

msg_orig(17)=1;

msg_orig(18)=1;

msg_orig(19)=0;

msg_orig(20)=0;

msg_orig(21)=0;

msg_orig(22)=1;

msg_orig(23)=0;

msg_orig(24)=0;

msg_NRZ=zeros(1,1152);

sig_I=zeros(1,1152);

t=[1:1:1152];

k=1;

t_1 = [ 0 : 1 :1152 ]; % Time Samples

f = 8000; % Input Signal Frequency

fs = 96000; % Sampling Frequency

c_carrier = round(10000*sin(2*pi*f/fs*t_1)); % Generate Sine Wave

for j=1:24

if msg_orig(j)==1

for m=1:48

msg_NRZ(k)=1;

k=k+1;

end

end

if msg_orig(j)==0

for l=1:48

msg_NRZ(k)=-1;

k=k+1;

end

end

end

```
for i=1:1152
sig_I(i) = msg_NRZ(i) * c_carrier(i);
end
```

% figure(1);

% stem(t,sig_I,'r'); % View the samples

% figure(2);

% stem(t*1/fs*1000,sig_I,'r'); % View the samples

% hold on;

plot(t*1/fs*1000,sig_I); % Plot Sine Wave

Fs=96000;

T = 1/Fs; % Sample time

L = 8000; % Length of signal

NFFT = 2^nextpow2(L); % Next power of 2 from length of y

Y = fft(sig_I,NFFT)/L;

f = 96/2*linspace(0,1,NFFT/2+1);

% Plot single-sided amplitude spectrum.

plot(f*1000,2*abs(Y(1:NFFT/2+1)))

title('Single-Sided Amplitude Spectrum of BPSK signal')

xlabel('Frequency (Hz)')

ylabel('|Y(f)|')

Thanks in Advance.

]]>

This link is a photo of the homework assignment.

http://www.chegg.com/homework-help/questions-and-answers/someone-help-figure-matlab-program-run--im-issues-q7074389

What kind of inputs does the QAM functions would accept? ]]>

1|1|EL_1_BaDfG|4,41|5,1|6,99|8,76|9,27|13,88|14,19|15,91|19,4|21,48...

it means:

id|type|name|connected_to, weight|connected_to, weight| and so on..

And the taks is this:

The structure of the graph should have fields that represent the vertices array of structures , each of which represents a single node . Each of these structures has fields id , type, name , edges and possibly some additional fields that are required due to the specific time ( previousVertexId , weightFromStart ) . Edges is a series of structures that represent one branch each of these structures has fields endVertexId , status and eventual some specific fields to search for ( eg . Weight ) . Status field indicates the state of the switch , which can be 1 or 0. In the start, status is 1

I was trying to use fscanf function, but it only reads one whole line as one string. By using strsplit function i managed to separate those strings with delimiter |. How can I do the same for whole file and after that assign value to each edge(id, type,name,..)?

Best regards,

Dejan

]]>In fact, I'm working on a project which aims to implement a reconfigurable Zigbee tranceiver on XUPV5-LX110T Evaluation platform which integrates a Virtex 5 FPGA. I am currently in the phase of real test, so now I just want to test my transmitter.

First, I want to send my binary data from Matlab (computer) to FPGA. The medium of communication is the RS232 serial link. Is there a solution in Matlab (communication protocol) that sends a binary stream on this port knowing my main entrance on FPGA is 4 bits?

Secondly, how to create a PRBS (Pseudo Random Binary Sequence) in Matlab (an output of 4 bits) to integrate it into the communication protocol?

And thank you in advance for everyone.

Regards,

Isamel ]]>

I know that one way to do this is to create mex file for that VC++ executable project.

Is it possible to run simulation in Matlab GUI which i have already in VC++ using mex files. Does anyone has experience doing this stuff .

Is there any other way to achieve it. Thanking you. ]]>

this is wrong with the code To start with, the following lines are incorrect:

```
CONST=READ_CONi(i);
CONSTH=CONST(1);
CONSTL=CONST(2);
```

This way, you read 2 hexadecimal digits (8 bits) from the table, then

assign the first digit (left 4 bits) to CONSTH, and the second digit

(right 4 bits) to CONSTL. However, in section 2.3 of the algorithm, it

says the round constant is 6 bits and CONSTH is the left 3 bits and

CONSTL is the right 3 bits:

CONi(6) = CONiH(3) || CONiL(3)

and then when processing both CONSTH and CONSTL are padded with a '0' on

the left side.

You work on hex digits rather than bits, which is conceptually correct,

but wrong in terms of coding

I have been given a data.mat file which contains a dataset containing the varriables ( when i click on it in the workspace): data.X(258x226 double), data.Y (258x226 double), data.XUnits ('m'), data.YUnits ('m'), data.Val (43x257x225 double), data.Time (43x1 double), data.Name (`temp'), data.Units ('C')

Therefore, it has X coordinates, Y coordinates, time and a value at each one of these.

My question is can anyone give me a little script that will create a graph with TEMP (val) vs TIME for a given x and y coordinate?

]]>"Vq = interp3(X,Y,Z,V,Xq,Yq,Zq) returns... X, Y, and Z contain the coordinates of the sample points. V contains the corresponding function values (SCALAR) at each sample point. Xq, Yq, and Zq contain the coordinates of the query points." This is just what I have mentioned at the beginning. interp3 operate with function (bijection, correspondence) from space with 3 coordinates (3D, triplet) to space with 1 coordinate (1D, scalar). I want to establish and operate with correspondence from 3D to 3D..

TPS solves such problems. http://www.mathworks.com/matlabcentral/fileexchange/37576-3d-thin-plate-spline-warping-function

http://www.mathworks.com/matlabcentral/fileexchange/22227-thin-plate-splines

I used the first link. The interface is pretty straightforward. I marked: 1. points: old positions of control points; 2. ctrlpoints: new positions of control points; 3. object: source template.

But I want Kriging now.

Thank you very much.

]]>In fact, I'm working on a project which aims to implement a reconfigurable Zigbee tranceiver on XUPV5-LX110T Evaluation platform which integrates a Virtex 5 FPGA. I am currently in the phase of real test.

First, I want to send my data from a PC to FPGA and receive it (to treat my signals on Matlab). Is this possible or not? If yes, Is there a solution for it using a medium of communication (e.g. serial link)

Second, is there a measuring equipment and testing (e.g. Agilent or National Instruments using PXI) which supports the Zigbee wireless protocol or otherwise IEEE 802.15.4 standard (i.e. RF Vector Signal Generator and Vector Signal Analyzer) of the analog front-end either in transmission or reception?

And thanks a lot in advance for everyone. ]]>

I f anyone can give me only a code for four wheel vehicle dynamics it would also work.

Please help ]]>

My aim is to illustrate lissajous figure of CRO.

The concept is to plot a locus of point whose x & y coordinate vary with time.

In the code given below I have put x=sin(constant x t) , y=cos(1.5 x constant x t)

[code]

Fs = 8000; % samples per second

dt = 1/Fs; % seconds per sample

StopTime = 6.00; % seconds

t = (0:dt:StopTime-dt)'; % seconds

%% Sine wave:

Fc = 80; % hertz

c = -pi:.04:pi;

cx = sin(pi*Fc*t);

cy = cos(1.5*pi*Fc*t);

figure('color','white');

axis on, axis equal

line(cx, cy, 'color', [.4 .4 .8],'LineWidth',3);

title('sine on x , cos on y ','Color',[.6 0 0])

hold on

ht=plot(cx,cy,'r.','MarkerSize',20)

while (1)

for t = 1:length(t)

x(2) = cx(t);

y(2) = cy(t);

set(ht,'XData',x)

set(ht,'YData',y)

drawnow

end

t = (0:dt:StopTime-dt)';

end

[/code]

I have 3 questions

(1)If you will run this , you will see (other than a nice double boomerang animation) a red dot at origin in graph which I want to avoid.

(2)I want to create a slider button for user which replaces 1.5 in above . This way , when slider=1 you will see circle , as frequency multiplies you will see more vertically side by side loops . As frequency diminishes to fraction loop will appear horizontally stacked.

(3)it would be more exciting if there is a slider for changing phase difference .Currently it is 90 degree . As it will decreases the ellipse flattens. becomes straight line for 0 degree.

Thank You.

Eagerly waiting for your reply.

im not sure this is the right forum but since the headline says also "chilling after a day of programming" I thought I could post a tip for a mathmatical tool which seems to be something for the old idealists like myself, prefering programming tools to be free of charge and with an anarchistic touch. At www.varible.com you find a program similar to Matlab, it still seems to be under construction and it is not as advanced as the original, on the other side it gives you the opportunity to calculate standard functions in an easy way and if you want to, share your programs with friends and colleagues.

It is at least better than other "online calculators" I have found.

Have fun!

]]>"error creating file/Users.../filename.m in current folder: No such file or directory"

and then it asks me if I want to create an untitled document.

Help please!

If someone have any small virtual reality application/environment (which is built with initial tools of Virtual Reality Toolbox), please send me(with description) on my email address so that I understand this toolbox . [color=Blue]mwasif_ciit@yahoo.com[/color]

And if anyone have any helping materiel on Virtual Reality Toolbox of MATLAB, please send me.

I will be very thankful to you...

]]>

```
for(j=0;j<n;j++)
{
for(i=0,k=j;i<=j && k<=j; i++)
{
print [k][i] //this part prints the value present in [k][i] co-ordinates of a 2-D array
k--;
}
}
```

I am not getting how to write this in MATLAB. Help

]]>http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.39.5132&rep=rep1&type=pdf ]]>

I'm trying to figure out how the integrator block from Simulink works. I'm doing this because I need to make an arduino program in order to implement a space-state control.

Any help is welcome. Thanks in advance

]]>I have written code to generate a graph in Matlab. However the Journal I am submitting my manuscript to, has given the following guidelines to convert matlab images to tif:

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&7

Export High Resolution Images from Matlab

Knowing the target size of your image in inches and ppi, first convert the number of rows and columns in the image. 4.86 inches by 9.19 inches (a 1.5-column figure at maximum height) at 300ppi corresponds to 1458 pixels by 2757 pixels. Modify your image to be 1458 by 2757. (Resize it, crop it, compute it differently, etc.) Then save your 1458 by 2757 image to a TIFF file, specifying 300 as the resolution:

imwrite(my_image, 'figure_10_a.tif', 'Resolution', 300);

function writeFig300ppi(figNo, fileName)

%make the backgroung white

set(figNo,]]>

f=imread('source_image.jpg');

figure(1)

imshow(f)

imwrite(f,'new_tif_image_file.tif','compression','none','resolution',...

[100 80])

g=imread('new_tif_image_file.tif');

figure(2)

imshow(g)

~~after all these done I look at two images and they look same...

what problem in this code?

]]>

%Consider the mass-damper system with dead zone as depicted in Figure E.1.

%The motion of the system is described by the following combination of

%equations:

%my" + 2cy' + k(y + b) = F(t), y<-b

%my" + 2cy' = F(t), -b<=y<=b

%my" + 2cy' + k(y - b) = F(t), y>b

%%

%(a) Rewrite the above as a single equation using the heaviside function.

```
A = [ 0 0 0 5
0 2 0 0
1 3 0 0
0 0 4 0];
a=size(A);
b=size(A);
c=0;
position=0;
for i=1:a for j=1:b if A(i,j) ~=0
c=c+1;
position=position+1;
S(c,:)=[position,i,j,A(i,j)];
end
end
end
S
```

S --> is the storage matrix for all the non zero elements for A matrix. In addition to this information(Index,Row Number, Column Number, Value) how do I include two more columns in the matrix which shows the next element in row & the next element in column.

]]>I have a large data set, consisting of 17 elements with more than 30000 samples which i use as an Input and a Target data set. I use the GUI in NN Toolbox to load the data and perform the training. The results after training seem to be good, as i get a relatively small error. However when i load the second data set which i want to use for the simulation my error gets really high. I read about generalization problems and over fitting issues but I'm not sure how to deal with these and how to change my code so that i improve my simulation performance.

Furthermore I'm not sure about the setup of my network - number of hidden neurons, the percentages of Tr./Val./Test. etc?

I would be really thankful if anyone could help me out here. Thanks & best regards

]]>

I want to implement mexican hat wavelet on a 2-D image like lena and extract feature points from it.

Please guide me.

Thank You

]]>

I want simulate classically (not quantum mechanics) a electron orbiting a proton (H atom) immerse in a random distribution electromagnetic field. This theory is known as SED http://www.bu.edu/simulation/publications/dcole/PD...

For now we will forget the random EM. Since I'm trying first simulate the electron orbit without influence of EM.

As you now classically the electron feel the Coulomb force and the reaction term. The reaction term make the electron spin down and shock with the nucleus, the proton.

The non-relativistic Lorentz/Dirac equation to the movement is:

m*z'' = (-e^2)*z/|z|^3 + REAC - e*(EM)

The EM are the E and B random equations but for now we will forget this term.

REAC is the reaction term =>

2/3 * e^2 /c^3 * z''' (so third order differential eq)

but REAC can be approximated to

2/3 * e^2 /c^3 * d/dt( (-e^2)/m * z / z^3 ) ---> first order equation

the problem is in 2D x-y, so the vector z have two components, the z is the radius = sqrt(x^2 + y^2)

I can plot the electron orbit only with the Coulomb term:

((-e^2)*z/|z|^3)

but I cannot plot correctly with the REAC term. I already try use the ode45, the ode23 and the ode23t

I also tried use the REAC in the first form (third order ode) and in the second form

I also tried use polar coordinates, I'm lost I need help the following code is the my successful implementation of ode without the REAC

function mov = semZPF2(t,y)

r=(sqrt(y(1)^2+y(2)^2));

e = 1.602177e-19;

m=9.10938291*10^-31;

mov(1)=y(3);

mov(2)=y(4);

mov(3)=(-e^2*y(1)/r^3)/m;

mov(4)=(-e^2*y(2)/r^3)/m;

return;

------------------------------------------------------

yi=[0 5.3*10^-11]; % initial position

vi=[23.0583421525753 0]; % initial velocity

[t,y]= ode45(@(t,y) semZPF2(t,y,), [0 1E-12] , [yi vi] );

plot (y(i,1), y(i,2))

Please I need your help to implement the REAC term

m*z'' = (-e^2)*z/|z|^3 + REAC

thanks,

Carlos Henriques

]]>

I'm trying to convert a Qmil file to a usable file in Solid works. Now, i have found a basic programme in matlab which does the converting of the files to slices, which are importable in Matlab. I have basic nknowledge of amatlab and have figured some stuff out, but still have some problems. The matlab file reads .txt files for the data of airfoils and the output data of qmil, which is a dos program, the output of this program is also .txt.

I get the following errors:

1. ??? Error using ==> vertcat

CAT arguments dimensions are not consistent.

I have looked up this error and there would need to be a mistake in the horzcat, but I can't find it. The matlab file is attached to this topic. Could it be an error because i use horzcat (-X,Y,Z)?

2.

Error in ==> matlabconverting at 31

dlmwrite(['Slice_' int2str(i)

Here the matlab file would convert the entire propeller i want to make to slices at certain parts, which are importable into solid works. Problem: It only generates the first 9 slides. I will look for myself a bit, but it would be awesome if this matlab file works. In attachment i have put everything (txt files, matlab file). If someone could give me some tips or advice it would be great. Again, I have not written this code, just edited it (I will give credit to the original author of course), to make it work with my data.

]]>

If anyone can help me with code. I will be very grateful

]]>

a1=[1 1 1 1 1 1 1 1] 1X8

a1=[1 1 1 1 1 1 1 1] 1X8

a1=[1 1 1 1 1 1 1 1]1X8

a1=[1 1 1 1 1 1 1 1]1X8

i need to call these using

for loop for generating different combinations is it possible how to do it.

]]>

i read http://www.mathworks.in/help/matlab/creating_plots/figures-plots-and-graphs.html to get an idea.

Yet , no clue about making 3d graphs.

i am using matlab 8.01 in windos 7 64bit.

]]>

[code]Ka = 1.755388e-5;

Ca = 0.5;

Cb = 0.1;

Va = 100;

Vb = 0.1:0.1:1200;

Ma = (Ca * Va) / 1000;

Mb = (Cb .* Vb) ./ 1000;

for i = 1:length(Mb)

M_excess = Ma - Mb(i);

if abs(M_excess)<eps

Hplus = Ka * ((Ma_final * 0.999999) ./ Mb_final);

Vb_ev = Vb(i);

pH_ev = pH(end);

else

Ma_final = (M_excess * 1000) ./ (Va + Vb(i));

Mb_final = (Mb(i) * 1000) ./ (Va + Vb(i));

Hplus = Ka * (Ma_final ./ Mb_final);

end

pH(i) = -log10(Hplus);

end

%

Vb_Mid_Pt1 = find half of Vb_ev

pH_Mid_Pt1 = i want to find pH at Vb_Mid_Pt1;[/code]]]>

load('coil') % Load coil response data

time = 1/40:1/40:288000/40; %Create time vector for later plotting

%Removing Coil Response

T2=load(mag); %Load data

y=abs(real(T2.y.data));

t = angle(T2.y.data); %Create a phase vector for the original data

Fs = 40; %Sampling frequency

NFFT = size(y);

NFFT=NFFT(1);

j = [y,t]; %Create a matrix of amplitude and phase

Y = fft2(j); %2D transform

F = ((0:1./NFFT:1-1./NFFT)*Fs);

F1=coil(:,1); %Load coil phase delay

P=coil(:,3);

Pnew=interp1(F1,P,F); %Create the phase delay vector of the same length

Pnew(1) = Pnew(2);

Pnew=Pnew';

t_fin = t-Pnew %Subtract the pahse delay from the original phase vector

%Mag_Final = ifft(abs(Y));

%Phase_Final = ifft(phaseF);

j_fin = [y,t_fin]; %Create matrix of amplitude versus correct phase

Final = ifft(j_fin); %Invert the transform

y = struct('data',Final);

save('y')

Both t and y are magnitude and phase data in the time domain. coil(:,1) and could(:,3) are the frequency and phase vectors of the instument response. So the phase vector Pnew is in the frequency domain. IS there another way to correct the phase? Of not, how to I turn the corrected phase vector back into a time domain function?

]]>