Category: Matlab
Category Archives: Matlab
In Simscape Rankine Cycle example the Turbine does not rotate
I tried to see how the rankine example worked but could not get my head around.
I have seen that elements like motor convert electrical energy to torque and you can measure it using an Ideal Rotational Motion Sensor:
In the "Rankine Cycle" example you can see a turbine connected to a flow energy:
If you replace the Load by a "Rotational Motion Sensor" it will never change from 0, no matter how much flow passes into the turbine through the ports A and B:
So, my question is why? I saw in the "load" block there is a speed source forcing the turbine to rotate at nominal speed, and summing the linear torque to it but why?I tried to see how the rankine example worked but could not get my head around.
I have seen that elements like motor convert electrical energy to torque and you can measure it using an Ideal Rotational Motion Sensor:
In the "Rankine Cycle" example you can see a turbine connected to a flow energy:
If you replace the Load by a "Rotational Motion Sensor" it will never change from 0, no matter how much flow passes into the turbine through the ports A and B:
So, my question is why? I saw in the "load" block there is a speed source forcing the turbine to rotate at nominal speed, and summing the linear torque to it but why? I tried to see how the rankine example worked but could not get my head around.
I have seen that elements like motor convert electrical energy to torque and you can measure it using an Ideal Rotational Motion Sensor:
In the "Rankine Cycle" example you can see a turbine connected to a flow energy:
If you replace the Load by a "Rotational Motion Sensor" it will never change from 0, no matter how much flow passes into the turbine through the ports A and B:
So, my question is why? I saw in the "load" block there is a speed source forcing the turbine to rotate at nominal speed, and summing the linear torque to it but why? rankine-cycle, turbine, torque, speed, energy MATLAB Answers — New Questions
Is there matlab code to do the mean variance spanning test with short sales constrains?
I found only tests without restrictions, but are there test with restrictions regarding weights of portfolio eleents?I found only tests without restrictions, but are there test with restrictions regarding weights of portfolio eleents? I found only tests without restrictions, but are there test with restrictions regarding weights of portfolio eleents? statistical test, mean varince spanning, portfolio theory MATLAB Answers — New Questions
Speed up Some Code
Hi all. I’m trying to speed up the code below. It’s from the SMOTE function that was wrtitten for MATLAB and works really well. The only thing is that the loops are not fast. I’ve looked at Parfor but that wouldn’t work and I can’t see how I can vectorise it either. It could be I just have to suck it up and wait but just in case, the code is :-
% This is where the magic happens 😉
% X : Observational matrix (rows are observations, columns are variables)
% J : Synthesization vector. It has the same length as the number of
% observations (rows) in X. J determines how many times each
% observation is used as a base for synthesization.
% k : Number of nearest neighbors to consider when synthesizing.
function Xn = simpleSMOTE(X,J,k)
tic
HNSMdl = hnswSearcher(X); % To remove this, comment out this line and replace the HNSMdl below with X
[idx, ~] = knnsearch(HNSMdl,X,’k’,k+1); % Find nearest neighbors (add one to the number of neighbors to find, as observations are their own nearest neighbor)
toc
Xn = nan(sum(J),size(X,2)); % Pre-allocate memory for synthesized observations
% Iterate through observations to create to synthesize new observations
for ii=1:numel(J)
P = randperm(k,J(ii))+1; % Randomize nearest neighbor pick (never pick first nearest neighbor as this is the observation itself)
for jj=1:J(ii)
x = X(idx(ii,1),:); % Observation
xk = X(idx(ii,P(jj)),:); % Nearest neighbor
Xn(sum(J(1:ii-1))+jj,:) = (xk-x)*rand+x; % Synthesize observation
end
end
end
It’s from the ‘for ii’ bit that is slow and there are around 750000 items of 13 variables.
SteveHi all. I’m trying to speed up the code below. It’s from the SMOTE function that was wrtitten for MATLAB and works really well. The only thing is that the loops are not fast. I’ve looked at Parfor but that wouldn’t work and I can’t see how I can vectorise it either. It could be I just have to suck it up and wait but just in case, the code is :-
% This is where the magic happens 😉
% X : Observational matrix (rows are observations, columns are variables)
% J : Synthesization vector. It has the same length as the number of
% observations (rows) in X. J determines how many times each
% observation is used as a base for synthesization.
% k : Number of nearest neighbors to consider when synthesizing.
function Xn = simpleSMOTE(X,J,k)
tic
HNSMdl = hnswSearcher(X); % To remove this, comment out this line and replace the HNSMdl below with X
[idx, ~] = knnsearch(HNSMdl,X,’k’,k+1); % Find nearest neighbors (add one to the number of neighbors to find, as observations are their own nearest neighbor)
toc
Xn = nan(sum(J),size(X,2)); % Pre-allocate memory for synthesized observations
% Iterate through observations to create to synthesize new observations
for ii=1:numel(J)
P = randperm(k,J(ii))+1; % Randomize nearest neighbor pick (never pick first nearest neighbor as this is the observation itself)
for jj=1:J(ii)
x = X(idx(ii,1),:); % Observation
xk = X(idx(ii,P(jj)),:); % Nearest neighbor
Xn(sum(J(1:ii-1))+jj,:) = (xk-x)*rand+x; % Synthesize observation
end
end
end
It’s from the ‘for ii’ bit that is slow and there are around 750000 items of 13 variables.
Steve Hi all. I’m trying to speed up the code below. It’s from the SMOTE function that was wrtitten for MATLAB and works really well. The only thing is that the loops are not fast. I’ve looked at Parfor but that wouldn’t work and I can’t see how I can vectorise it either. It could be I just have to suck it up and wait but just in case, the code is :-
% This is where the magic happens 😉
% X : Observational matrix (rows are observations, columns are variables)
% J : Synthesization vector. It has the same length as the number of
% observations (rows) in X. J determines how many times each
% observation is used as a base for synthesization.
% k : Number of nearest neighbors to consider when synthesizing.
function Xn = simpleSMOTE(X,J,k)
tic
HNSMdl = hnswSearcher(X); % To remove this, comment out this line and replace the HNSMdl below with X
[idx, ~] = knnsearch(HNSMdl,X,’k’,k+1); % Find nearest neighbors (add one to the number of neighbors to find, as observations are their own nearest neighbor)
toc
Xn = nan(sum(J),size(X,2)); % Pre-allocate memory for synthesized observations
% Iterate through observations to create to synthesize new observations
for ii=1:numel(J)
P = randperm(k,J(ii))+1; % Randomize nearest neighbor pick (never pick first nearest neighbor as this is the observation itself)
for jj=1:J(ii)
x = X(idx(ii,1),:); % Observation
xk = X(idx(ii,P(jj)),:); % Nearest neighbor
Xn(sum(J(1:ii-1))+jj,:) = (xk-x)*rand+x; % Synthesize observation
end
end
end
It’s from the ‘for ii’ bit that is slow and there are around 750000 items of 13 variables.
Steve speed, code, loops MATLAB Answers — New Questions
Matlab and Routh criterion for evaluation of K for stability
I am traying to evaluation & solve this system stability for the equation s^3 + 3ks^2 + ( k+2 )s + 4 = 0
I strugling with the k constant .
but need help on how to insert the K as a constant for the ROUTH HURWITZ in matlab .
%%routh hurwitz criteria
clear
clc
%firstly it is required to get first two row of routh matrix
e=input(‘enter the coefficients of characteristic equation: ‘);
disp(‘————————————————————————-‘)
l=length(e);
m=mod(l,2);
if m==0
a=rand(1,(l/2));
b=rand(1,(l/2));
for i=1:(l/2)
a(i)=e((2*i)-1);
b(i)=e(2*i);
end
else
e1=[e 0];
a=rand(1,((l+1)/2));
b=[rand(1,((l-1)/2)),0];
for i=1:((l+1)/2)
a(i)=e1((2*i)-1);
b(i)=e1(2*i);
end
end
%%now we genrate the remaining rows of routh matrix
l1=length(a);
c=zeros(l,l1);
c(1,:)=a;
c(2,:)=b;
for m=3:l
for n=1:l1-1
c(m,n)=-(1/c(m-1,1))*det([c((m-2),1) c((m-2),(n+1));c((m-1),1) c((m-1),(n+1))]);
end
end
disp(‘the routh matrix:’)
disp(c)
%%now we check the stablity of system
if c(:,1)>0
disp(‘System is Stable’)
else
disp(‘System is Unstable’);
endI am traying to evaluation & solve this system stability for the equation s^3 + 3ks^2 + ( k+2 )s + 4 = 0
I strugling with the k constant .
but need help on how to insert the K as a constant for the ROUTH HURWITZ in matlab .
%%routh hurwitz criteria
clear
clc
%firstly it is required to get first two row of routh matrix
e=input(‘enter the coefficients of characteristic equation: ‘);
disp(‘————————————————————————-‘)
l=length(e);
m=mod(l,2);
if m==0
a=rand(1,(l/2));
b=rand(1,(l/2));
for i=1:(l/2)
a(i)=e((2*i)-1);
b(i)=e(2*i);
end
else
e1=[e 0];
a=rand(1,((l+1)/2));
b=[rand(1,((l-1)/2)),0];
for i=1:((l+1)/2)
a(i)=e1((2*i)-1);
b(i)=e1(2*i);
end
end
%%now we genrate the remaining rows of routh matrix
l1=length(a);
c=zeros(l,l1);
c(1,:)=a;
c(2,:)=b;
for m=3:l
for n=1:l1-1
c(m,n)=-(1/c(m-1,1))*det([c((m-2),1) c((m-2),(n+1));c((m-1),1) c((m-1),(n+1))]);
end
end
disp(‘the routh matrix:’)
disp(c)
%%now we check the stablity of system
if c(:,1)>0
disp(‘System is Stable’)
else
disp(‘System is Unstable’);
end I am traying to evaluation & solve this system stability for the equation s^3 + 3ks^2 + ( k+2 )s + 4 = 0
I strugling with the k constant .
but need help on how to insert the K as a constant for the ROUTH HURWITZ in matlab .
%%routh hurwitz criteria
clear
clc
%firstly it is required to get first two row of routh matrix
e=input(‘enter the coefficients of characteristic equation: ‘);
disp(‘————————————————————————-‘)
l=length(e);
m=mod(l,2);
if m==0
a=rand(1,(l/2));
b=rand(1,(l/2));
for i=1:(l/2)
a(i)=e((2*i)-1);
b(i)=e(2*i);
end
else
e1=[e 0];
a=rand(1,((l+1)/2));
b=[rand(1,((l-1)/2)),0];
for i=1:((l+1)/2)
a(i)=e1((2*i)-1);
b(i)=e1(2*i);
end
end
%%now we genrate the remaining rows of routh matrix
l1=length(a);
c=zeros(l,l1);
c(1,:)=a;
c(2,:)=b;
for m=3:l
for n=1:l1-1
c(m,n)=-(1/c(m-1,1))*det([c((m-2),1) c((m-2),(n+1));c((m-1),1) c((m-1),(n+1))]);
end
end
disp(‘the routh matrix:’)
disp(c)
%%now we check the stablity of system
if c(:,1)>0
disp(‘System is Stable’)
else
disp(‘System is Unstable’);
end guide, matlab MATLAB Answers — New Questions
Can use help me. Using the eliminant, determine the frequency equation of the system
% using the eliminant, determine the frequency equation of the system
syms w;
% Given parameters
m1 = 1.8; m2 = 6.3; m3 = 5.4; m4 = 22.5; m5 = 54;
c2 = 10000; c3 = 500; c4 = 1500; c5 = 1100;
k2 = 100000000; k3 = 50000; k4 = 75000; k5 = 10000;
% Mass, damping, and stiffness matrices
M = diag([m1, m2, m3, m4, m5]);
C = [c2 -c2 0 0 0;
-c2 c2+c3 -c3 0 0;
0 -c3 c3+c4 -c4 0;
0 0 -c4 c4+c5 -c5;
0 0 0 -c5 c5];
K = [k2 -k2 0 0 0;
-k2 k2+k3 -k3 0 0;
0 -k3 k3+k4 -k4 0;
0 0 -k4 k4+k5 -k5;
0 0 0 -k5 k5];% using the eliminant, determine the frequency equation of the system
syms w;
% Given parameters
m1 = 1.8; m2 = 6.3; m3 = 5.4; m4 = 22.5; m5 = 54;
c2 = 10000; c3 = 500; c4 = 1500; c5 = 1100;
k2 = 100000000; k3 = 50000; k4 = 75000; k5 = 10000;
% Mass, damping, and stiffness matrices
M = diag([m1, m2, m3, m4, m5]);
C = [c2 -c2 0 0 0;
-c2 c2+c3 -c3 0 0;
0 -c3 c3+c4 -c4 0;
0 0 -c4 c4+c5 -c5;
0 0 0 -c5 c5];
K = [k2 -k2 0 0 0;
-k2 k2+k3 -k3 0 0;
0 -k3 k3+k4 -k4 0;
0 0 -k4 k4+k5 -k5;
0 0 0 -k5 k5]; % using the eliminant, determine the frequency equation of the system
syms w;
% Given parameters
m1 = 1.8; m2 = 6.3; m3 = 5.4; m4 = 22.5; m5 = 54;
c2 = 10000; c3 = 500; c4 = 1500; c5 = 1100;
k2 = 100000000; k3 = 50000; k4 = 75000; k5 = 10000;
% Mass, damping, and stiffness matrices
M = diag([m1, m2, m3, m4, m5]);
C = [c2 -c2 0 0 0;
-c2 c2+c3 -c3 0 0;
0 -c3 c3+c4 -c4 0;
0 0 -c4 c4+c5 -c5;
0 0 0 -c5 c5];
K = [k2 -k2 0 0 0;
-k2 k2+k3 -k3 0 0;
0 -k3 k3+k4 -k4 0;
0 0 -k4 k4+k5 -k5;
0 0 0 -k5 k5]; matlab, vibration MATLAB Answers — New Questions
Google Earth Trajectory Path
I want to show the path drawn by our rocket on google earth. However, I need to make it inclined as in the link below. How can I do this?
Most probably I need to use sin and cos functions, but I don’t know what to write according to.
http://www.spacemig.com/path-in/I want to show the path drawn by our rocket on google earth. However, I need to make it inclined as in the link below. How can I do this?
Most probably I need to use sin and cos functions, but I don’t know what to write according to.
http://www.spacemig.com/path-in/ I want to show the path drawn by our rocket on google earth. However, I need to make it inclined as in the link below. How can I do this?
Most probably I need to use sin and cos functions, but I don’t know what to write according to.
http://www.spacemig.com/path-in/ google, matlab gui, kml, kmz, earth, matlab code, matlab function, matlab, trajectory, aerospace, rocket, path MATLAB Answers — New Questions
How can I get the energy of a wave?
I used signal analyzer to analyze a wave of the sound.
Now I would like to calculate the energy of the sound.
My idea is to firstly squared the amplitude and then integrated the whole wave.
I have squared the amplitude and got the diagram of squared amplitude v.s. time.
However, I don’t know how to integrate this wave without having a wavefunction.
How could I do? Thank you.I used signal analyzer to analyze a wave of the sound.
Now I would like to calculate the energy of the sound.
My idea is to firstly squared the amplitude and then integrated the whole wave.
I have squared the amplitude and got the diagram of squared amplitude v.s. time.
However, I don’t know how to integrate this wave without having a wavefunction.
How could I do? Thank you. I used signal analyzer to analyze a wave of the sound.
Now I would like to calculate the energy of the sound.
My idea is to firstly squared the amplitude and then integrated the whole wave.
I have squared the amplitude and got the diagram of squared amplitude v.s. time.
However, I don’t know how to integrate this wave without having a wavefunction.
How could I do? Thank you. signal, integration MATLAB Answers — New Questions
Write a MATLAB function named areaIntegration that takes multiple input arguments representing different shapes and their coordinates. The function should integrate the areas
Write a MATLAB function named areaIntegration that takes multiple input arguments
representing different shapes and their coordinates. The function should integrate the areas made up
of these shapes using Boolean algebra and return the total integrated area.
The function signature should be:
function totalArea = areaIntegration(shape1, shape2,…)
Where shape1, shape2, etc. are arrays representing different shapes, their scale, operation, and
location. Each cell array should contain 5 elements such that:
• 1
st Element is the shape identifier where “1” represent a square and “0” present a circle.
• 2
nd Element is the scale of the shape.
• 3
rd Element is the type of operation where ‘0’ is Union, ‘1’ is Subtract, and ‘2’ is
Intersection with the shape of the previous argument.
• 4
th and 5th is the location of the shape in Cartesian coordinate (i.e. x and y).
Together they form an array like this:
[shape identifier, scale, operation type, x-coordinate, y-coordinate].
For example:
1. If the 1st argument is an array [1, 1, 2, 0, 0], it means it is a square with a 1 unit dimension
located at (0, 0), intersecting with the existing 2D space.
2. The 2nd argument, an array with the value [0, 2, 0, -1, 1], represents a circle with a 2 unit
radius located at (-1, 1) to union with the result left by the 1st argument.Write a MATLAB function named areaIntegration that takes multiple input arguments
representing different shapes and their coordinates. The function should integrate the areas made up
of these shapes using Boolean algebra and return the total integrated area.
The function signature should be:
function totalArea = areaIntegration(shape1, shape2,…)
Where shape1, shape2, etc. are arrays representing different shapes, their scale, operation, and
location. Each cell array should contain 5 elements such that:
• 1
st Element is the shape identifier where “1” represent a square and “0” present a circle.
• 2
nd Element is the scale of the shape.
• 3
rd Element is the type of operation where ‘0’ is Union, ‘1’ is Subtract, and ‘2’ is
Intersection with the shape of the previous argument.
• 4
th and 5th is the location of the shape in Cartesian coordinate (i.e. x and y).
Together they form an array like this:
[shape identifier, scale, operation type, x-coordinate, y-coordinate].
For example:
1. If the 1st argument is an array [1, 1, 2, 0, 0], it means it is a square with a 1 unit dimension
located at (0, 0), intersecting with the existing 2D space.
2. The 2nd argument, an array with the value [0, 2, 0, -1, 1], represents a circle with a 2 unit
radius located at (-1, 1) to union with the result left by the 1st argument. Write a MATLAB function named areaIntegration that takes multiple input arguments
representing different shapes and their coordinates. The function should integrate the areas made up
of these shapes using Boolean algebra and return the total integrated area.
The function signature should be:
function totalArea = areaIntegration(shape1, shape2,…)
Where shape1, shape2, etc. are arrays representing different shapes, their scale, operation, and
location. Each cell array should contain 5 elements such that:
• 1
st Element is the shape identifier where “1” represent a square and “0” present a circle.
• 2
nd Element is the scale of the shape.
• 3
rd Element is the type of operation where ‘0’ is Union, ‘1’ is Subtract, and ‘2’ is
Intersection with the shape of the previous argument.
• 4
th and 5th is the location of the shape in Cartesian coordinate (i.e. x and y).
Together they form an array like this:
[shape identifier, scale, operation type, x-coordinate, y-coordinate].
For example:
1. If the 1st argument is an array [1, 1, 2, 0, 0], it means it is a square with a 1 unit dimension
located at (0, 0), intersecting with the existing 2D space.
2. The 2nd argument, an array with the value [0, 2, 0, -1, 1], represents a circle with a 2 unit
radius located at (-1, 1) to union with the result left by the 1st argument. matlab MATLAB Answers — New Questions
can not read input from DC power to MATLAB using F28379D
Hello , I am trying to read accurate DC input by using voltege sensor & current sensor with F28379D, but unfortunately not gave me a correct input
i use matlab 2023a
if any subject wrote on it, or there are video about it or who works on it send to me (sarawi22@gmail.com) or write soluation downHello , I am trying to read accurate DC input by using voltege sensor & current sensor with F28379D, but unfortunately not gave me a correct input
i use matlab 2023a
if any subject wrote on it, or there are video about it or who works on it send to me (sarawi22@gmail.com) or write soluation down Hello , I am trying to read accurate DC input by using voltege sensor & current sensor with F28379D, but unfortunately not gave me a correct input
i use matlab 2023a
if any subject wrote on it, or there are video about it or who works on it send to me (sarawi22@gmail.com) or write soluation down dc input by f28379d MATLAB Answers — New Questions
Barchart colorbar colors from second vector
I have a variant of this question:
https://au.mathworks.com/matlabcentral/answers/506415-bar-chart-legend-and-colour?s_tid=sug_su
I have a bar chart where I am colouring the bars based on a second corresponding vector.
%%
clear
close all
clc
ids1 = [2,4,5,6,8];
meanVals = [0.2,0.204,0.199,0.208,0.19];
velMns = [16.384,16.98,17.182,18.001,18.40];
figure;
b=bar(ids1,meanVals);
xticks(ids1)
grid on
labels = pad(string(b(1).YData),6);
labelsShrt=[extractBetween(labels,1,5)]’;
xtips = b(1).XEndPoints;
ytips = b(1).YEndPoints;
text(xtips,ytips,labelsShrt,’HorizontalAlignment’,’center’,…
‘VerticalAlignment’,’bottom’,’FontSize’,8);
title(‘mean values’)
ylim([min(meanVals)-0.02 max(meanVals)+0.005])
% set bar color
MaxV = 20;
MinV = 5;
range=MaxV-MinV;
colors = jet(range); % Define a colormap
b.FaceColor = ‘flat’;
for II = 1:length(ids1)
barColorID = round(velMns(II),0)-MinV;
b.CData(II,:) = colors(barColorID,:);
end
cbar = colorbar;
caxis([MinV MaxV]);
This works as desired apart from the colormap of the colorbar, which does not correspond to the second vector.
Thanks in advanceI have a variant of this question:
https://au.mathworks.com/matlabcentral/answers/506415-bar-chart-legend-and-colour?s_tid=sug_su
I have a bar chart where I am colouring the bars based on a second corresponding vector.
%%
clear
close all
clc
ids1 = [2,4,5,6,8];
meanVals = [0.2,0.204,0.199,0.208,0.19];
velMns = [16.384,16.98,17.182,18.001,18.40];
figure;
b=bar(ids1,meanVals);
xticks(ids1)
grid on
labels = pad(string(b(1).YData),6);
labelsShrt=[extractBetween(labels,1,5)]’;
xtips = b(1).XEndPoints;
ytips = b(1).YEndPoints;
text(xtips,ytips,labelsShrt,’HorizontalAlignment’,’center’,…
‘VerticalAlignment’,’bottom’,’FontSize’,8);
title(‘mean values’)
ylim([min(meanVals)-0.02 max(meanVals)+0.005])
% set bar color
MaxV = 20;
MinV = 5;
range=MaxV-MinV;
colors = jet(range); % Define a colormap
b.FaceColor = ‘flat’;
for II = 1:length(ids1)
barColorID = round(velMns(II),0)-MinV;
b.CData(II,:) = colors(barColorID,:);
end
cbar = colorbar;
caxis([MinV MaxV]);
This works as desired apart from the colormap of the colorbar, which does not correspond to the second vector.
Thanks in advance I have a variant of this question:
https://au.mathworks.com/matlabcentral/answers/506415-bar-chart-legend-and-colour?s_tid=sug_su
I have a bar chart where I am colouring the bars based on a second corresponding vector.
%%
clear
close all
clc
ids1 = [2,4,5,6,8];
meanVals = [0.2,0.204,0.199,0.208,0.19];
velMns = [16.384,16.98,17.182,18.001,18.40];
figure;
b=bar(ids1,meanVals);
xticks(ids1)
grid on
labels = pad(string(b(1).YData),6);
labelsShrt=[extractBetween(labels,1,5)]’;
xtips = b(1).XEndPoints;
ytips = b(1).YEndPoints;
text(xtips,ytips,labelsShrt,’HorizontalAlignment’,’center’,…
‘VerticalAlignment’,’bottom’,’FontSize’,8);
title(‘mean values’)
ylim([min(meanVals)-0.02 max(meanVals)+0.005])
% set bar color
MaxV = 20;
MinV = 5;
range=MaxV-MinV;
colors = jet(range); % Define a colormap
b.FaceColor = ‘flat’;
for II = 1:length(ids1)
barColorID = round(velMns(II),0)-MinV;
b.CData(II,:) = colors(barColorID,:);
end
cbar = colorbar;
caxis([MinV MaxV]);
This works as desired apart from the colormap of the colorbar, which does not correspond to the second vector.
Thanks in advance bar, colorbar MATLAB Answers — New Questions
sol = bvp4c (OdeBVP, OdeBC, solinit, options);
ne the boundary conditions
function res = OdeBc (ya, yb, A, s, B, lambda)
global A s B lambda
res= [ya(1)-s;
ya(2)-lambda-A*ya(3);
ya(4)-1-B*ya(5);
yb(2);
yb(4)];
end
% setting the initial guess for first solution
function v = OdeInit1(x,A,s,lambda)
global A s lambda
v=[s+0.56
0
0
0
0];
end
% setting the initial guess for second solution
function v1 =OdeInit2(x, A, s)
global A s
v1 = [exp(-x)
exp(-x)
-exp(-x)
-exp(-x)
-exp(-x)];
end
endne the boundary conditions
function res = OdeBc (ya, yb, A, s, B, lambda)
global A s B lambda
res= [ya(1)-s;
ya(2)-lambda-A*ya(3);
ya(4)-1-B*ya(5);
yb(2);
yb(4)];
end
% setting the initial guess for first solution
function v = OdeInit1(x,A,s,lambda)
global A s lambda
v=[s+0.56
0
0
0
0];
end
% setting the initial guess for second solution
function v1 =OdeInit2(x, A, s)
global A s
v1 = [exp(-x)
exp(-x)
-exp(-x)
-exp(-x)
-exp(-x)];
end
end ne the boundary conditions
function res = OdeBc (ya, yb, A, s, B, lambda)
global A s B lambda
res= [ya(1)-s;
ya(2)-lambda-A*ya(3);
ya(4)-1-B*ya(5);
yb(2);
yb(4)];
end
% setting the initial guess for first solution
function v = OdeInit1(x,A,s,lambda)
global A s lambda
v=[s+0.56
0
0
0
0];
end
% setting the initial guess for second solution
function v1 =OdeInit2(x, A, s)
global A s
v1 = [exp(-x)
exp(-x)
-exp(-x)
-exp(-x)
-exp(-x)];
end
end not enough input arguments. MATLAB Answers — New Questions
CAD design in Google Earth
Can we use a CAD design in Siemens Nx as a kml file on Google earth and make animation?Can we use a CAD design in Siemens Nx as a kml file on Google earth and make animation? Can we use a CAD design in Siemens Nx as a kml file on Google earth and make animation? siemens, solidworks, matlab, matlab code, google, simulation, simulink, animation, kml, kmz, toolbox MATLAB Answers — New Questions
Why does imhist() do this?
I thought I had asked this once before, but maybe it was a fever dream. It’s hard to tell at this point.
IPT imhist() is a convenience tool for creating histograms of grayscale image data. It bins the image data such that the end bins are centered on the ends of the interval implied by the numeric class of the data (e.g. [0 1] for ‘double’). It displays the histogram using a stem() plot, with one stem in the center of each histogram bin.
This much might be disagreeable, since the end bins are effectively half-width, but let’s accept the choice to align the bin centers to the interval limits instead of aligning the bin edges.
What I can’t understand is the colorbar. Beneath the stem plot is a grayscale colorbar showing the progression N gray levels corresponding to the N histogram bins. The problem is twofold:
While the histogram bin centers are aligned to the interval limits (and cannot be changed), the gray segments of the colorbar have their edges aligned with the interval limits — and they can’t be changed either. The two are always misaligned.
The actual gray values used in the colorbar correspond to the upper edge of where the histogram bins would be if they were edge-aligned, but they’re not. The first half of the gray segments don’t even correspond to the bin they represent. The asymmetry makes plots with small N extra nonsensical.
So I put together a thing for visual emphasis and figured I’d run it here to see if it’s just my old version. It’s not.
% some inputs
inpict = rand(500);
n = 5;
% imhist can either give outputs or plot.
% it can’t do both, so we have to call it twice.
imhist(inpict,n); hold on
[counts centers] = imhist(inpict,n);
% find the axes since it won’t give them to us
hax = findobj(get(gcf,’children’),’type’,’axes’);
% figure out the bin edges from the centers,
% since it won’t give us edges either
dx = diff(centers(1:2));
xr = [centers(1)-dx/2 centers(end)+dx/2];
yr = ylim(hax(2));
% create two images:
% top is a smooth sweep from black to white.
% bottom corresponds to the center of each histogram bin.
% the two images should periodically match at each bin center.
smoothramp = repmat(linspace(xr(1),xr(2),100),[1 1 3]);
binramp = repmat(centers.’,[1 1 3]);
binramp = imresize(binramp,[1 size(smoothramp,2)],’nearest’);
% put an image behind the stem plot
hi = image(xr,yr,[binramp; smoothramp],’parent’,hax(2));
uistack(hi,’bottom’)
% find the stem plot and make it fat so it’s easier to see
hst = findobj(hax(2),’type’,’stem’);
set(hst,’linewidth’,3)
% draw a solid gray circle above each stem,
% such that the circle color is taken directly from the stem position
for k = 1:n
hp = plot(hax(2),centers(k),yr(2)*0.67,’.’);
hp.Color = [1 1 1]*centers(k);
hp.MarkerSize = 60;
end
So we have a stem plot, two images, and circular plot markers that all agree, but the color bar is off doing its own thing. The gray level in the first two colorbar segments isn’t even in the corresponding histogram bin.
Apparently this is the way imhist() has done it for at least the last 15 years, so is there actually a reason for it, or is it just one of those forever-bugs?
I’m in the middle of trying to write my way around MIMT’s usage of imhist(), and I’m inclined to just take a step back and make a complete replacement instead.I thought I had asked this once before, but maybe it was a fever dream. It’s hard to tell at this point.
IPT imhist() is a convenience tool for creating histograms of grayscale image data. It bins the image data such that the end bins are centered on the ends of the interval implied by the numeric class of the data (e.g. [0 1] for ‘double’). It displays the histogram using a stem() plot, with one stem in the center of each histogram bin.
This much might be disagreeable, since the end bins are effectively half-width, but let’s accept the choice to align the bin centers to the interval limits instead of aligning the bin edges.
What I can’t understand is the colorbar. Beneath the stem plot is a grayscale colorbar showing the progression N gray levels corresponding to the N histogram bins. The problem is twofold:
While the histogram bin centers are aligned to the interval limits (and cannot be changed), the gray segments of the colorbar have their edges aligned with the interval limits — and they can’t be changed either. The two are always misaligned.
The actual gray values used in the colorbar correspond to the upper edge of where the histogram bins would be if they were edge-aligned, but they’re not. The first half of the gray segments don’t even correspond to the bin they represent. The asymmetry makes plots with small N extra nonsensical.
So I put together a thing for visual emphasis and figured I’d run it here to see if it’s just my old version. It’s not.
% some inputs
inpict = rand(500);
n = 5;
% imhist can either give outputs or plot.
% it can’t do both, so we have to call it twice.
imhist(inpict,n); hold on
[counts centers] = imhist(inpict,n);
% find the axes since it won’t give them to us
hax = findobj(get(gcf,’children’),’type’,’axes’);
% figure out the bin edges from the centers,
% since it won’t give us edges either
dx = diff(centers(1:2));
xr = [centers(1)-dx/2 centers(end)+dx/2];
yr = ylim(hax(2));
% create two images:
% top is a smooth sweep from black to white.
% bottom corresponds to the center of each histogram bin.
% the two images should periodically match at each bin center.
smoothramp = repmat(linspace(xr(1),xr(2),100),[1 1 3]);
binramp = repmat(centers.’,[1 1 3]);
binramp = imresize(binramp,[1 size(smoothramp,2)],’nearest’);
% put an image behind the stem plot
hi = image(xr,yr,[binramp; smoothramp],’parent’,hax(2));
uistack(hi,’bottom’)
% find the stem plot and make it fat so it’s easier to see
hst = findobj(hax(2),’type’,’stem’);
set(hst,’linewidth’,3)
% draw a solid gray circle above each stem,
% such that the circle color is taken directly from the stem position
for k = 1:n
hp = plot(hax(2),centers(k),yr(2)*0.67,’.’);
hp.Color = [1 1 1]*centers(k);
hp.MarkerSize = 60;
end
So we have a stem plot, two images, and circular plot markers that all agree, but the color bar is off doing its own thing. The gray level in the first two colorbar segments isn’t even in the corresponding histogram bin.
Apparently this is the way imhist() has done it for at least the last 15 years, so is there actually a reason for it, or is it just one of those forever-bugs?
I’m in the middle of trying to write my way around MIMT’s usage of imhist(), and I’m inclined to just take a step back and make a complete replacement instead. I thought I had asked this once before, but maybe it was a fever dream. It’s hard to tell at this point.
IPT imhist() is a convenience tool for creating histograms of grayscale image data. It bins the image data such that the end bins are centered on the ends of the interval implied by the numeric class of the data (e.g. [0 1] for ‘double’). It displays the histogram using a stem() plot, with one stem in the center of each histogram bin.
This much might be disagreeable, since the end bins are effectively half-width, but let’s accept the choice to align the bin centers to the interval limits instead of aligning the bin edges.
What I can’t understand is the colorbar. Beneath the stem plot is a grayscale colorbar showing the progression N gray levels corresponding to the N histogram bins. The problem is twofold:
While the histogram bin centers are aligned to the interval limits (and cannot be changed), the gray segments of the colorbar have their edges aligned with the interval limits — and they can’t be changed either. The two are always misaligned.
The actual gray values used in the colorbar correspond to the upper edge of where the histogram bins would be if they were edge-aligned, but they’re not. The first half of the gray segments don’t even correspond to the bin they represent. The asymmetry makes plots with small N extra nonsensical.
So I put together a thing for visual emphasis and figured I’d run it here to see if it’s just my old version. It’s not.
% some inputs
inpict = rand(500);
n = 5;
% imhist can either give outputs or plot.
% it can’t do both, so we have to call it twice.
imhist(inpict,n); hold on
[counts centers] = imhist(inpict,n);
% find the axes since it won’t give them to us
hax = findobj(get(gcf,’children’),’type’,’axes’);
% figure out the bin edges from the centers,
% since it won’t give us edges either
dx = diff(centers(1:2));
xr = [centers(1)-dx/2 centers(end)+dx/2];
yr = ylim(hax(2));
% create two images:
% top is a smooth sweep from black to white.
% bottom corresponds to the center of each histogram bin.
% the two images should periodically match at each bin center.
smoothramp = repmat(linspace(xr(1),xr(2),100),[1 1 3]);
binramp = repmat(centers.’,[1 1 3]);
binramp = imresize(binramp,[1 size(smoothramp,2)],’nearest’);
% put an image behind the stem plot
hi = image(xr,yr,[binramp; smoothramp],’parent’,hax(2));
uistack(hi,’bottom’)
% find the stem plot and make it fat so it’s easier to see
hst = findobj(hax(2),’type’,’stem’);
set(hst,’linewidth’,3)
% draw a solid gray circle above each stem,
% such that the circle color is taken directly from the stem position
for k = 1:n
hp = plot(hax(2),centers(k),yr(2)*0.67,’.’);
hp.Color = [1 1 1]*centers(k);
hp.MarkerSize = 60;
end
So we have a stem plot, two images, and circular plot markers that all agree, but the color bar is off doing its own thing. The gray level in the first two colorbar segments isn’t even in the corresponding histogram bin.
Apparently this is the way imhist() has done it for at least the last 15 years, so is there actually a reason for it, or is it just one of those forever-bugs?
I’m in the middle of trying to write my way around MIMT’s usage of imhist(), and I’m inclined to just take a step back and make a complete replacement instead. imhist, histogram MATLAB Answers — New Questions
How to convert a long data file csv into a wide data file csv
Hello everyone,
I’ve this big problem with this data file csv that I would like to convert into a wide one. The aim is to obtain instead of a column in which the numerical values of Activation appear, two columns respectively Activation_1 and Activation_2. These must correspond to the relative values of the Condition, the first Cond1_N and the second Cond2_U.
Below I have attached a photo of what the original long format looks like. If anyone could help me I would be happy! Thank youHello everyone,
I’ve this big problem with this data file csv that I would like to convert into a wide one. The aim is to obtain instead of a column in which the numerical values of Activation appear, two columns respectively Activation_1 and Activation_2. These must correspond to the relative values of the Condition, the first Cond1_N and the second Cond2_U.
Below I have attached a photo of what the original long format looks like. If anyone could help me I would be happy! Thank you Hello everyone,
I’ve this big problem with this data file csv that I would like to convert into a wide one. The aim is to obtain instead of a column in which the numerical values of Activation appear, two columns respectively Activation_1 and Activation_2. These must correspond to the relative values of the Condition, the first Cond1_N and the second Cond2_U.
Below I have attached a photo of what the original long format looks like. If anyone could help me I would be happy! Thank you longtowidefile MATLAB Answers — New Questions
Need help for Influence line plotting
I am a civil engineering student specializing in Structural Design. I’m working on a project for a "Prestressed Concrete" course, where I am designing a section for a bridge with prestressed reinforcement. As part of the project, I need to first construct envelopes for the shear force and bending moment for the bridge under a loading pattern where a four-axle truck (in addition to the dead load) traverses the bridge, with different weights for the front and rear axles, thus resulting in different forces. The truck can approach the bridge from either side.
I’ve attached an image to clarify the loading pattern; ‘X’ in the image marks the truck’s position relative to the bridge’s edge.
I have developed MATLAB code that plots the shear and moment envelopes based on the influence line method. The problem is that I am getting non-symmetric graphs, which suggests there is an issue with the code.
In the attached image of the code output for the shear envelope, it can be seen that at a distance of 3 meters relative to the beam center (18 meters), the values obtained are not identical, making the graph asymmetric. I would appreciate any help to correct the code. I am open to different methods that could help solve the issue.
Thank you!!I am a civil engineering student specializing in Structural Design. I’m working on a project for a "Prestressed Concrete" course, where I am designing a section for a bridge with prestressed reinforcement. As part of the project, I need to first construct envelopes for the shear force and bending moment for the bridge under a loading pattern where a four-axle truck (in addition to the dead load) traverses the bridge, with different weights for the front and rear axles, thus resulting in different forces. The truck can approach the bridge from either side.
I’ve attached an image to clarify the loading pattern; ‘X’ in the image marks the truck’s position relative to the bridge’s edge.
I have developed MATLAB code that plots the shear and moment envelopes based on the influence line method. The problem is that I am getting non-symmetric graphs, which suggests there is an issue with the code.
In the attached image of the code output for the shear envelope, it can be seen that at a distance of 3 meters relative to the beam center (18 meters), the values obtained are not identical, making the graph asymmetric. I would appreciate any help to correct the code. I am open to different methods that could help solve the issue.
Thank you!! I am a civil engineering student specializing in Structural Design. I’m working on a project for a "Prestressed Concrete" course, where I am designing a section for a bridge with prestressed reinforcement. As part of the project, I need to first construct envelopes for the shear force and bending moment for the bridge under a loading pattern where a four-axle truck (in addition to the dead load) traverses the bridge, with different weights for the front and rear axles, thus resulting in different forces. The truck can approach the bridge from either side.
I’ve attached an image to clarify the loading pattern; ‘X’ in the image marks the truck’s position relative to the bridge’s edge.
I have developed MATLAB code that plots the shear and moment envelopes based on the influence line method. The problem is that I am getting non-symmetric graphs, which suggests there is an issue with the code.
In the attached image of the code output for the shear envelope, it can be seen that at a distance of 3 meters relative to the beam center (18 meters), the values obtained are not identical, making the graph asymmetric. I would appreciate any help to correct the code. I am open to different methods that could help solve the issue.
Thank you!! matlab function, function, civil engineering MATLAB Answers — New Questions
Improve fit quality for a custom function with near-perfect starting values
I’m trying to fit data with a relatively complicated custom function (combined logistic+linear function; combined effect of my data+noise). By trail-and-error I can manually find a good fit (indicated below), but I want MATLAB to do the final fine-tuning. Instead, the MATLAB fit is way worse than what I can do manually. As this takes minutes to do by hand and I will need to process hundreds of images, I really want to automate this.
This is the starting fit I provide manually:
<</matlabcentral/answers/uploaded_files/120202/fitInit.png>>
This is the fit after MATLAB is done (using the manual fit values as startpoint):
<</matlabcentral/answers/uploaded_files/120203/fitDone.png>>
I tried:
* Setting lower and upper bounds
* Parameter scaling (all coefficients between 1E-2 and 1E2)
* Changing algorithm
* Setting DiffMinChange and DiffMaxChange to small values
* Changing TolX and TolFun
*The main thing I don’t understand is why MATLAB worsens the fit.* Especially with low DiffMinChange and DiffMaxChange, I would expect MATLAB to give the starting fit or something better.
In case people want to try for themselves, below I provide the data and custom function.
The data-to-fit is in ‘data.txt’, while the function I use to fit it is:
I=@(Ac,b,AE,bg,bgx,x) AE.*(1./(1+1E15./Ac.*exp(-b.*x)))+bg+bgx.*x;.
The manual startpoint is
start=[1.75 0.065 14 16 0.015];
To help with interpretation of the function:
* It is a logistic function ‘1/(1+1E15./Ac*exp(-b*x))’,
* a scale-factor for the logistic function ‘AE’, (the 1E15 is to scale the parameter)
* a background offset ‘bg’, and
* a background slope ‘bgx’.I’m trying to fit data with a relatively complicated custom function (combined logistic+linear function; combined effect of my data+noise). By trail-and-error I can manually find a good fit (indicated below), but I want MATLAB to do the final fine-tuning. Instead, the MATLAB fit is way worse than what I can do manually. As this takes minutes to do by hand and I will need to process hundreds of images, I really want to automate this.
This is the starting fit I provide manually:
<</matlabcentral/answers/uploaded_files/120202/fitInit.png>>
This is the fit after MATLAB is done (using the manual fit values as startpoint):
<</matlabcentral/answers/uploaded_files/120203/fitDone.png>>
I tried:
* Setting lower and upper bounds
* Parameter scaling (all coefficients between 1E-2 and 1E2)
* Changing algorithm
* Setting DiffMinChange and DiffMaxChange to small values
* Changing TolX and TolFun
*The main thing I don’t understand is why MATLAB worsens the fit.* Especially with low DiffMinChange and DiffMaxChange, I would expect MATLAB to give the starting fit or something better.
In case people want to try for themselves, below I provide the data and custom function.
The data-to-fit is in ‘data.txt’, while the function I use to fit it is:
I=@(Ac,b,AE,bg,bgx,x) AE.*(1./(1+1E15./Ac.*exp(-b.*x)))+bg+bgx.*x;.
The manual startpoint is
start=[1.75 0.065 14 16 0.015];
To help with interpretation of the function:
* It is a logistic function ‘1/(1+1E15./Ac*exp(-b*x))’,
* a scale-factor for the logistic function ‘AE’, (the 1E15 is to scale the parameter)
* a background offset ‘bg’, and
* a background slope ‘bgx’. I’m trying to fit data with a relatively complicated custom function (combined logistic+linear function; combined effect of my data+noise). By trail-and-error I can manually find a good fit (indicated below), but I want MATLAB to do the final fine-tuning. Instead, the MATLAB fit is way worse than what I can do manually. As this takes minutes to do by hand and I will need to process hundreds of images, I really want to automate this.
This is the starting fit I provide manually:
<</matlabcentral/answers/uploaded_files/120202/fitInit.png>>
This is the fit after MATLAB is done (using the manual fit values as startpoint):
<</matlabcentral/answers/uploaded_files/120203/fitDone.png>>
I tried:
* Setting lower and upper bounds
* Parameter scaling (all coefficients between 1E-2 and 1E2)
* Changing algorithm
* Setting DiffMinChange and DiffMaxChange to small values
* Changing TolX and TolFun
*The main thing I don’t understand is why MATLAB worsens the fit.* Especially with low DiffMinChange and DiffMaxChange, I would expect MATLAB to give the starting fit or something better.
In case people want to try for themselves, below I provide the data and custom function.
The data-to-fit is in ‘data.txt’, while the function I use to fit it is:
I=@(Ac,b,AE,bg,bgx,x) AE.*(1./(1+1E15./Ac.*exp(-b.*x)))+bg+bgx.*x;.
The manual startpoint is
start=[1.75 0.065 14 16 0.015];
To help with interpretation of the function:
* It is a logistic function ‘1/(1+1E15./Ac*exp(-b*x))’,
* a scale-factor for the logistic function ‘AE’, (the 1E15 is to scale the parameter)
* a background offset ‘bg’, and
* a background slope ‘bgx’. curve fitting MATLAB Answers — New Questions
‘sparameters’ function showing error to read S-parameter data from touchstone file
I am trying to read S-parameter data from touchstone file using the following option:
sobj = sparameters(filename)
But getting the following errors
"Error using rf.file.touchstone.Data/read
Data is inconsistent with the Touchstone format.
Error in rf.file.touchstone.Data
Error in rf.internal.netparams.AllParameters/readRFFile
Error in rf.internal.netparams.AllParameters
Error in rf.internal.netparams.ScatteringParameters
Error in sparameters (line 80)
obj = obj@rf.internal.netparams.ScatteringParameters(varargin{:});"
The touchstone file is in DB/angle format
! …
# GHz S DB R 50
!
Is that an issue or the problem is somewhre else?
Note that I can read the touchstone file without any issue in other commercial software.I am trying to read S-parameter data from touchstone file using the following option:
sobj = sparameters(filename)
But getting the following errors
"Error using rf.file.touchstone.Data/read
Data is inconsistent with the Touchstone format.
Error in rf.file.touchstone.Data
Error in rf.internal.netparams.AllParameters/readRFFile
Error in rf.internal.netparams.AllParameters
Error in rf.internal.netparams.ScatteringParameters
Error in sparameters (line 80)
obj = obj@rf.internal.netparams.ScatteringParameters(varargin{:});"
The touchstone file is in DB/angle format
! …
# GHz S DB R 50
!
Is that an issue or the problem is somewhre else?
Note that I can read the touchstone file without any issue in other commercial software. I am trying to read S-parameter data from touchstone file using the following option:
sobj = sparameters(filename)
But getting the following errors
"Error using rf.file.touchstone.Data/read
Data is inconsistent with the Touchstone format.
Error in rf.file.touchstone.Data
Error in rf.internal.netparams.AllParameters/readRFFile
Error in rf.internal.netparams.AllParameters
Error in rf.internal.netparams.ScatteringParameters
Error in sparameters (line 80)
obj = obj@rf.internal.netparams.ScatteringParameters(varargin{:});"
The touchstone file is in DB/angle format
! …
# GHz S DB R 50
!
Is that an issue or the problem is somewhre else?
Note that I can read the touchstone file without any issue in other commercial software. sparameters, touchstone MATLAB Answers — New Questions
Can we sense the vibration & tilt of vehicle in driving scenario design app.
Post Content Post Content automotive, driving design scenerio, matlab, simulink MATLAB Answers — New Questions
Unable to resolve the name ‘idpack.utConvertDataToOriginalDataType’.
Hello Community
I have problems running a script with the function ‘misdata’.
The code runs fine on other computers.
Any ideas or suggetions for an alternative, or how fix the problem are highly appreciated.
%%%Code%%%
load(‘processed_data.mat’);
Ps = 7;
time = pkf(Ps).time_nan;
y = pkf(Ps).cen_nan;
u = pkf(Ps).dos_matched_nan;
%Apply a second order model for
tau = 0.5; %Time constant
us = smooth_data(time,u,tau);
%Create a timetable of the data:
TT = array2timetable([us,y],"RowTimes",minutes(time),’VariableNames’,{‘InputName’,’OutputName’});
TTm = misdata(TT); %Remove missing data
ym = TTm.OutputData;
um = TTm.InputData;
save([‘Person’,num2str(Ps),’_processed_data.mat’],"um","ym","u","us","y","time","TTm",’-mat’);
%%% Error %%%
Unable to resolve the name ‘idpack.utConvertDataToOriginalDataType’.
Error in misdata (line 166)
de = idpack.utConvertDataToOriginalDataType(de,’timetable’,’misdata’);
Error in Remove_missing_and_smooth_Data (line 16)
TTm = misdata(TT); %Remove missing dataHello Community
I have problems running a script with the function ‘misdata’.
The code runs fine on other computers.
Any ideas or suggetions for an alternative, or how fix the problem are highly appreciated.
%%%Code%%%
load(‘processed_data.mat’);
Ps = 7;
time = pkf(Ps).time_nan;
y = pkf(Ps).cen_nan;
u = pkf(Ps).dos_matched_nan;
%Apply a second order model for
tau = 0.5; %Time constant
us = smooth_data(time,u,tau);
%Create a timetable of the data:
TT = array2timetable([us,y],"RowTimes",minutes(time),’VariableNames’,{‘InputName’,’OutputName’});
TTm = misdata(TT); %Remove missing data
ym = TTm.OutputData;
um = TTm.InputData;
save([‘Person’,num2str(Ps),’_processed_data.mat’],"um","ym","u","us","y","time","TTm",’-mat’);
%%% Error %%%
Unable to resolve the name ‘idpack.utConvertDataToOriginalDataType’.
Error in misdata (line 166)
de = idpack.utConvertDataToOriginalDataType(de,’timetable’,’misdata’);
Error in Remove_missing_and_smooth_Data (line 16)
TTm = misdata(TT); %Remove missing data Hello Community
I have problems running a script with the function ‘misdata’.
The code runs fine on other computers.
Any ideas or suggetions for an alternative, or how fix the problem are highly appreciated.
%%%Code%%%
load(‘processed_data.mat’);
Ps = 7;
time = pkf(Ps).time_nan;
y = pkf(Ps).cen_nan;
u = pkf(Ps).dos_matched_nan;
%Apply a second order model for
tau = 0.5; %Time constant
us = smooth_data(time,u,tau);
%Create a timetable of the data:
TT = array2timetable([us,y],"RowTimes",minutes(time),’VariableNames’,{‘InputName’,’OutputName’});
TTm = misdata(TT); %Remove missing data
ym = TTm.OutputData;
um = TTm.InputData;
save([‘Person’,num2str(Ps),’_processed_data.mat’],"um","ym","u","us","y","time","TTm",’-mat’);
%%% Error %%%
Unable to resolve the name ‘idpack.utConvertDataToOriginalDataType’.
Error in misdata (line 166)
de = idpack.utConvertDataToOriginalDataType(de,’timetable’,’misdata’);
Error in Remove_missing_and_smooth_Data (line 16)
TTm = misdata(TT); %Remove missing data misdata MATLAB Answers — New Questions
How to check if a number is power of a prime number?
How to check if a number is power of a prime number?
e.g. 9, 25, 27, 36 are powers of a prime number. Program should return logical 1 for these kinds of numbers.How to check if a number is power of a prime number?
e.g. 9, 25, 27, 36 are powers of a prime number. Program should return logical 1 for these kinds of numbers. How to check if a number is power of a prime number?
e.g. 9, 25, 27, 36 are powers of a prime number. Program should return logical 1 for these kinds of numbers. prime-power check MATLAB Answers — New Questions