[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

]]>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?

]]>

I'm kinda new to Matlab so I don't exactly know how to tackle my problem. I am using bitplane Imaris and we have a volume with neurons imaged within it. What we get then is filaments and spots, which are assigned to be dendrites and terminals. The traced filaments that share same axon and such and all terminals that are on those filaments are all apart of one axon. Im trying to figure out how to calculate the path length between terminals via the branches. This gets very tedious when you have over 10 terminals on an axon. I don't know where to start to try to figure out how to classify branches and such and terminals so that it can detect which terminals and stuff and make the correct calculation.

Any advice would be greatly appreciated

]]>

I am wishing to create a neural network with inputs (20), hidden layer one (9 neurons), hidden layer two (8 neurons) and output (1)

I have used the GUI nftool to setup a neural network with inputs (20), one hidden layer (9 neurons) and output (1)

I have printed off the advanced script and wish to tweak it to accommodate what I want..............

Can somebody help me do the tweaking?

Thank you

Bob M]]>