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

]]>If there is anyone who can guide me or share some code of power allocation, sub-carrier allocation and channel capacity enhancement with me i will be thankful to him in advance.I am working on resource allocation of power line communication. ]]>

this is the code i m using. can someone tell me where i m wrong n how to fix it?

clear all

Video1 = VideoReader('C:\Users\User\Desktop\FYP\database\walking\person01_walking_d1_uncomp.avi');

for i=1:218

% keyboard

data(:,:,i)=mean(readFrame(Video1),3);

end

data = uint8(255 * mat2gray (data));

```
MHI = data;
% Define MHI parameter T
T = size(data,3)+20; % # of frames being considered; maximal value of MHI
% Load the first frame
frame1 = data(:,:,1);
% Get the dimensions of the frames
[y_max, x_max] = size(frame1);
% Compute H(x,y,1,T) (the first MHI)
fst = MHI(:,:,1);
fst(fst>0) = T;
MHI(:,:,1) = fst;
% start global loop for each frame
for frameIndex = 2 : size(data,3)
%fprintf('Loading frame Index %d\n',frameIndex);
% Load current frame from image array
frame = data(:,frameIndex);
frame_pre = MHI(:,frameIndex-1);
MHI(:,frameIndex) = frame_pre - 1;
% Set of all non-zero value to T
frame(frame > 0) = T;
[y,x] = find(frame > 1);
for i = 1 : size(y,1)
MHI(y(i,:), x(i,:), frameIndex) = frame(y(i,:), x(i,:));
end
end
figure, imshow(MHI(:,:,218), []);
```

]]>
where the coefficients |*a*| and |*b*| are to be read from a text file.

.

**I tried the following,**

```
function out = rosenbrock(x)
disp('rosenbrock()..........called');
coeff = load('coeff.txt');
a = coeff(1);
b = coeff(2);
xx = x(1);
yy = x(2);
out = (1 - xx + a)^2 + 100*(yy - b - (xx-a)^2)^2;
end
```

**But it is doing two things,**

(1) Slowing down the performance of the optimization.

(2) The output is also not correct (the optimization isn't converging).

**How can I solve this issue wile fulfilling my requirement?**

Is it possible to pass the values of |a| and |b| as the arguments of *|rosenbrockwithgrad()|*?

I have tried the following,

```
rosenbrockwithgrad_p = @(x)[rosenbrock(x, a, b);
(nargout > 1) * gradient(x)];
% calling fminunc
[x, fval, eflag, output] = fminunc(@rosenbrockwithgrad_p, x0, options);
```

It doesn't work.

**Relevant Source Code**

```
function [x, fval, eflag, iter, fcount] =
Optimization_With_Analytic_Gradient(start_point)
x0 = start_point;
% inline function defitions
%fungrad = @(x)deal(fun(x),grad(x));
% options setup
options = optimoptions( 'fminunc', ...
'Display','off',...
'OutputFcn',@bananaout,...
'Algorithm','trust-region', ...
'GradObj','on');
% calling fminunc
[x, fval, eflag, output] = fminunc(@rosenbrockwithgrad, x0, options);
iter = output.iterations;
fcount = output.funcCount;
% plot window title
title 'Rosenbrock with Analytic Gradient...'
disp('Optimization_With_Analytic_Gradient...');
end
function out = gradient( x )
out = [-400*(x(2) - x(1)^2)*x(1) - 2*(1 - x(1));
200*(x(2) - x(1)^2)];
end
function [f,g] = rosenbrockwithgrad(x)
% Calculate objective f
f = rosenbrock(x);
if nargout > 1 % gradient required
g = gradient(x);
end
end
```

]]>
I am trying to solve a system of 2 ordinary differential equations using matlab. However, I am not able to get numerical solutions from the code despite having keyed in all possible solutions.

The equations I am given are:

dx/dt=A(x/t)+By

dy/dt=C(x/t^2)+D(y/t)

and the boundary conditions are:

y(1)=0; y(1.2)=-100E6

- The attempt at a solution

My code so far:

%Mechanical Properties of Material

E=200e9;

nu=0.3;

P=100E6;

%Constants A,B,C,D in the Equations

a11= (1/E);

a12= (-nu/E);

a33= (1/E);

A= (a12)/(a11+a12);

B= ((a33)-((2*a12^2)/(a11+a12)));
C= (a11)/(a11^2-a12^2);
D= (2*a12+a11)/(a11+a12);

%Defining the System of 2ODES

syms x(t) y(t)

eqns = [diff(x,t)==A

cond = [y(1) == 0, y(1.2)==-P];

withSimplifications = dsolve(eqns, cond)

withoutSimplifications = dsolve(eqns, cond, 'IgnoreAnalyticConstraints', false)

[xSol(t), ySol(t)] = dsolve(eqns)

The answer is get is

Warning: Explicit solution could not be found.

In dsolve (line 201)

In IsotropicThickWallCylinder (line 18)

xSol(t) =

[ empty sym ]

ySol(t) =

[ empty sym ]

Would really appreciate some help.

]]>function out = logipack(V)

m = size(V, 1);

S = cell(m, 1);

for r = 1:m

S{r} = find(V(r, );

m = size(V, 1);

if isempty(V(r))

S{r}= [];

end

end

out = S;

end

I am trying to open a file in MATLAB and output the distance parameters. Perhaps there is somewhere I can put the text file and my code and get some help on debugging why the output is wrong?

I am a newbee on this forum!

Regards

Ayushi

Given the following equations ; cos^2(x/2)=(tan(x)+sin(x))/2*tan(x) Please write a Matlab code to verify that the identity is correct when x=π/5.

cos(pi/5)

cos(pi/5)=(tan(pi/5)+sin(pi/5))/(2tan(pi/5))

cos(pi/5)*cos(pi/5)=(tan(pi/5)+sin(pi/5))/(2*tan(pi/5))

↑

Error: The expression to the left of the equals sign is not a valid target for an assignment.

cos(pi/5)*cos(pi/5)

ans =

```
0.6545
```

(tan(pi/5)+sin(pi/5))/(2*tan(pi/5))

ans =

```
0.9045
```

I have written the codes above but they are not matched. I kindly request your help. Thank you...

]]>take higher tone and lower then first toon i have.

I use the sample code like this:

```
F1 = fft(originalSignal);
N = numel(F1);
F1a = F1(1:N/2); % the lower half of the fft
F1b = F1(end:-1:N/2+1); % the upper half of the fft - flipped "the right way around"
t1 = 1:N/2; % indices of the lower half
t2 = 1+ (t1-1) / (1 + 2.^(2/12)); % finer sampling... will make peaks appear higher
F2a = interp1(t1, F1a, t2); % perform sampling of lower half
F2b = interp1(t1, F1b, t2); % resample upper half
F2 = [F2a F2b(end:-1:1)]; % put the two together again
shiftedSignal = ifft(F2); % and do the inverse FFT
```

[

http://stackoverflow.com/questions/20076218/matlab-pitch-shifting-an-audio-signal]

With that sample code--t2 = 1+ (t1-1) / (1 + 2.^(2/12));--` I can take higher toon my wav file produced. But, I couldn't get the lower toon that i want. Please help me to solve that probem. I am a beginer. Thankyou..

]]>Can someone lead me in the right direction to get started? Please and Thank you.

Abdul

Review Question 1:

Assume four row vectors name Prod10, Prod11,Prod12,and

% Prod13 contain data on the production of various electronic devices at

% your company during the four year 2010,2011,2012 and 2013, respectively.

% The corresponding elements in each represent the number of specific part

% manufactured during that year. For example, the first element might

% contain the number of 2N3904 transistor produced during each year, whereas

% the fifth column might contain the same number of elements, corresponding

% to the same produced items.

% Write a single line code to answer each of the following questions.You may

% use the results of any question to answer subsequent questions if desired

% Note that your solutions should work regarless of the number of elements

% in the four vectors.

% (a) Create a new vector TotalProd that contains the total number of each

% item produced during the four year period. Note that TotalProd will have

% the same number of elements as the original four vectors.

% (b) Create a new vector AvgProd that contains the average number

% produced per year of each item during the four year period. Note that

% AvgProd will have the same number of elements as the original four vectors

% (c) Create a four element column vector YearProd that contains the total

% the totalnumber of all units produced during each year.2010 production

% should be in the first top element.

% (d) Determine the maximum number of any type of device produced during

% each year and place the results in a four element column vector MaxProd

% (e) Determine the maximum number of any device produced during any year

% and place the result in the scalar OverallMax.

% (f) If your company makes a profit of one-fifth of one cent each device

% produced, regardless of type, determine the total profit made during this

% four year period and place the result in Profit. Your result should be in

% dollars.

I have a problem hope you can help. please review figure attached. I have 2 hemispheres (radius 10.5 and 2.5cm) that made slits. in the center is cube (red color) 1*1*1cm. I need to calculate area of cube that I see in different view. ex: when I see from view(90,45) I can see a part of cube-> I have to calculate area of this part. but at view (50,60) I can not see the cube => area is 0.

Your help is highly appreciated...

Thank a lots.

]]>Write a function called top_right that takes two inputs: a matrix N and a scalar non-negative integer n, in that order, where each dimension of N is greater than or equal to n. The function returns the n-by-n square array at the top right corner of N.

Write a function called peri_sum that computes the sum of the elements of an input matrix A that are on the “perimeter” of A. In other words, it adds together the elements that are in the first and last rows and columns. Note that the smallest dimension of A is at least 2, but you do not need to check this.

Write a function called light_speed that takes as input a row vector of distances in kilometers and returns two row vectors of the same length. Each element of the first output argument is the time in minutes that light would take to travel the distance specified by the corresponding element of the input vector. To check your math, it takes a little more than 8 minutes for sunlight to reach Earth which is 150 million kilometers away. The second output contains the input distances converted to miles. Assume that the speed of light is 300,000 km/s and that one mile equals 1.609 km.

Write a function that is called like this: amag = accelerate(F1,F2,m). F1 and F2 are three-element column vectors that represent two forces applied to a single object. The argument m equals the mass of the object in units of kilograms. The three elements of each force equal the x, y, and z components of the force in Newtons. The output variable amag is a scalar that is equal to the magnitude of the object’s acceleration. The function calculates the object’s acceleration vector a by using Newton’s law: F = ma, where F is the sum of F1 and F2. Then it returns the magnitude of a.

Write a function called income that takes two row vectors of the same length as input arguments. The first vector, rate contains the number of various products a company manufactures per hour simultaneously. The second vector, price includes the corresponding per item price they sell the given product for. The function must return the overall income the company generates in a week assuming a 6-day work week and two 8-hour long shifts per day.

Thank You!!!

]]>for j=1:99

%Complete Decomposition Contribution

GDC(j,i)=X(:,i)' * (M_d.^0.5) * eps_d(:,j) * eps_d(:,j)' * (M_d.^0.5) * X(:,i);

denom_d(j,i)=eps_d(:,j)' * (M_d.^0.5) * covar * (M_d.^0.5) * eps_d(:,j);

rGDC(j,i)=GDC(j,i)/denom_d(j,i);

end

end

Dimensions are X: 99 * 957 M_d:99 * 99 eps_d:99 * 99 covar: 99 * 99

All the above matrices and vectors are real but the following part of code when run on Matlab gives me a 99 * 957 matrix which has imaginary values. I cannot find the problem with this code. eps_d is a identity matrix of dimension 99 * 99.

thx!!

]]>1-

"Code an iterative method to find a solution to the following equation:

r=x-asinx-b=0

the coefficients a and b can be freely chosen. Plot the convergence steps in a graph with the number of iterations along the horizontal axis against values of r."

Any help at all would be appreciated.

Thanks,

Jason

]]>

Je cherche un programme de prévision ou prédiction à base de réseaux de neurones artificiels sur matlab permettant de prévoir plusieurs sorties à partir de quelques entrées.

S'il vous plait aidez moi.

Et merci bien. ]]>

Essentially what I have is a list of around 80 variables, I want matlab to evaluate every combination of 3 variables and spit out the maximum, it can't just be the highest 3 due to covariances etc.

Any help would be much appreciated

]]>I found a 74% OFF coupon to Learn Matlab Udemy course

Couponcode: MATLAB25

https://www.udemy.com/learn-matlab/?couponCode=MATLAB25 ]]>

I use Matlab for my PhD project.

I want to send the files, and metadata, that I am generating directly to cloud services and from there, I want to share with my professor.

Currently, I am copy and pasting one by one the files and send by email or dropbox. But, it is quite slow and I sometimes I can’t send all the files I would love, and I can only send files, none of the metadata (which I saved as json in a database).

Does someone know about any cloud platform for Matlab which could solve this for me?

Thanks.

]]>This is as fast as I have been able to do it. ****matlabFunction and subs go slower than this.

The code below is my solution and it is one loop. In my larger code the function f and point x0 change in every loop so you can imagine why I want this to go as fast as possible. I would greatly appreciate it if someone could go through this, and give me any pointers. If my coding is crap feel free to tell me

x = sym('x',[2,1]);

f = [x(1)-x(1)*cos(x(2)), x(2)-3*x(2)^2*cos(x(1))];

J = jacobian(f,x);

x0 = [2,1];

N=length(x0); % Number of equations

%% Transform into string

fstr = map2mat(char(f));

Jstr = map2mat(char(J));

% replace every occurence of 'xi' with 'x(i)'

Jstr = addPar(Jstr,N);

fstr = addPar(fstr,N);

x = x0;

phi0 = eval(fstr)

J = eval(Jstr)

function str = addPar(str,N)

% pstr = addPar(str,N)

% Transforms every occurence of xi in str into x(i)

% N is the maximum value of i

% replace every occurence of xi with x(i)

% note that we do this backwards to avoid x10 being

% replaced with x(1)0

for i=N1

is = num2str(i);

xis = ['x' is];

xpis = ['x(' is ')'];

str = strrep(str,xis,xpis);

end

function r = map2mat(r)

% MAP2MAT Maple to MATLAB string conversion.

% Lifted from the symbolic toolbox source code

% MAP2MAT(r) converts the Maple string r containing

% matrix, vector, or array to a valid MATLAB string.

%

% Examples: map2mat(matrix([[a,b], [c,d]]) returns

% [a,b;c,d]

% map2mat(array([[a,b], [c,d]]) returns

% [a,b;c,d]

% map2mat(vector([[a,b,c,d]]) returns

% [a,b,c,d]

% Deblank.

r(findstr(r,' ')) = [];

% Special case of the empty matrix or vector

if strcmp(r,'vector([])') | strcmp(r,'matrix([])') | ...

strcmp(r,'array([])')

r = [];

else

% Remove matrix, vector, or array from the string.

r = strrep(r,'matrix([[','['); r = strrep(r,'array([[','[');

r = strrep(r,'vector([','['); r = strrep(r,'],[',';');

r = strrep(r,']])',']'); r = strrep(r,'])',']');

end

]]>

I need to perform the following using MATLAB.

1) Identify duplicate years in 2nd column and keep the one with maximum value with the 3rd column.

For example, (see the image below) since I have two 1961 occurences in column 2, need to remove one 1961 which has a highest corresponsding value in 3rd column (keep row with 5430 and remove 1160)

How can I perform this in MATLAB. Any help is appreciated.

Thanks.

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