Category: News
How to : Prototype of an Automotive RADAR
i’m currently tryinh to make a reel prototype of an automotive radar using MATLAB/SIMULINK and Raspberry PI.
First developping multiple scenarios using driving scenario designer App, and exporting it to simulink ( scenario and radar blocs).
Then connecting my raspberry PI with my pc so that it will do the signal processing and give back the results ( range and velocety of each object) that will be ploted in MATLAB in reel time.i’m currently tryinh to make a reel prototype of an automotive radar using MATLAB/SIMULINK and Raspberry PI.
First developping multiple scenarios using driving scenario designer App, and exporting it to simulink ( scenario and radar blocs).
Then connecting my raspberry PI with my pc so that it will do the signal processing and give back the results ( range and velocety of each object) that will be ploted in MATLAB in reel time. i’m currently tryinh to make a reel prototype of an automotive radar using MATLAB/SIMULINK and Raspberry PI.
First developping multiple scenarios using driving scenario designer App, and exporting it to simulink ( scenario and radar blocs).
Then connecting my raspberry PI with my pc so that it will do the signal processing and give back the results ( range and velocety of each object) that will be ploted in MATLAB in reel time. radar, sensors, automotive, driving scenario designer, matlab, simulink, raspberry pi, hardware, while loop, real time, simulation, adas, signal processing, digital signal processing, carla, plot MATLAB Answers — New Questions
dim error of dlnetwork predict
Hello everyone, I am a newbie in matlab. I encountered a very basic problem, but I really don’t know how to solve it.
The problem statement is as follows:
My input dlx is 1(C)*13(B)*685(T) dlarray, this means it has 685 time and each time has 13 features. And the "net" dlnetwork is sequence to label, label is 2 classes. I hope output is 2*685, however is 2*13 dlarray.
Please tell me what is my problem?
Thank you very much for coming to see my question and wish you a happy life
Y_predicted = predict(net, dlx);Hello everyone, I am a newbie in matlab. I encountered a very basic problem, but I really don’t know how to solve it.
The problem statement is as follows:
My input dlx is 1(C)*13(B)*685(T) dlarray, this means it has 685 time and each time has 13 features. And the "net" dlnetwork is sequence to label, label is 2 classes. I hope output is 2*685, however is 2*13 dlarray.
Please tell me what is my problem?
Thank you very much for coming to see my question and wish you a happy life
Y_predicted = predict(net, dlx); Hello everyone, I am a newbie in matlab. I encountered a very basic problem, but I really don’t know how to solve it.
The problem statement is as follows:
My input dlx is 1(C)*13(B)*685(T) dlarray, this means it has 685 time and each time has 13 features. And the "net" dlnetwork is sequence to label, label is 2 classes. I hope output is 2*685, however is 2*13 dlarray.
Please tell me what is my problem?
Thank you very much for coming to see my question and wish you a happy life
Y_predicted = predict(net, dlx); dlarray, predict, dlnetwork MATLAB Answers — New Questions
Stimulation of a 3-order system and its control signal in Simulink
hello , I’d like implement the following system in simulink , the dynamics are for a one-link manipulator actuated by brush dc , all the information are provided in the images below ;
the results depicted in the article ;
guide to define kah ;hello , I’d like implement the following system in simulink , the dynamics are for a one-link manipulator actuated by brush dc , all the information are provided in the images below ;
the results depicted in the article ;
guide to define kah ; hello , I’d like implement the following system in simulink , the dynamics are for a one-link manipulator actuated by brush dc , all the information are provided in the images below ;
the results depicted in the article ;
guide to define kah ; control MATLAB Answers — New Questions
Communication with Logitech G29 Steering Wheel?
The G29 Simulink-Block shows a communication error/status (-1) during simulation run.
Logitech driver installed and works (Win10 OS); Realtime Toolbox available; steering wheel connected by USB
Is there something i missed?
Thanks
OMAThe G29 Simulink-Block shows a communication error/status (-1) during simulation run.
Logitech driver installed and works (Win10 OS); Realtime Toolbox available; steering wheel connected by USB
Is there something i missed?
Thanks
OMA The G29 Simulink-Block shows a communication error/status (-1) during simulation run.
Logitech driver installed and works (Win10 OS); Realtime Toolbox available; steering wheel connected by USB
Is there something i missed?
Thanks
OMA g29, simulink, communication, logitech MATLAB Answers — New Questions
what is the peak amplitude of fft?
Hi, I have a theoretical question about FFT. I’m trying to use fft to process some datas that I got with an accelerometer. I’ve already applied a low pass filter to my signal to reduce noise and also applied a flat top window in order to have the most accurate amplitude possible. Doing this I obtain a quite nice spectrum with only one peak at the frequency that I’m interested in, which is what I’m supposed to obtain by the way. Now the question is, and it’s a question that probably comes from my low understanding of FFT, is the FFT peak amplitude supposed to be the same value as the max amplitude of the original signal? Or is it supposed to be something else? FFT is something that I’ve wrapped my head around only in the last few weeks for a uni project without really knowing much about it. Thank you in advance for you help.Hi, I have a theoretical question about FFT. I’m trying to use fft to process some datas that I got with an accelerometer. I’ve already applied a low pass filter to my signal to reduce noise and also applied a flat top window in order to have the most accurate amplitude possible. Doing this I obtain a quite nice spectrum with only one peak at the frequency that I’m interested in, which is what I’m supposed to obtain by the way. Now the question is, and it’s a question that probably comes from my low understanding of FFT, is the FFT peak amplitude supposed to be the same value as the max amplitude of the original signal? Or is it supposed to be something else? FFT is something that I’ve wrapped my head around only in the last few weeks for a uni project without really knowing much about it. Thank you in advance for you help. Hi, I have a theoretical question about FFT. I’m trying to use fft to process some datas that I got with an accelerometer. I’ve already applied a low pass filter to my signal to reduce noise and also applied a flat top window in order to have the most accurate amplitude possible. Doing this I obtain a quite nice spectrum with only one peak at the frequency that I’m interested in, which is what I’m supposed to obtain by the way. Now the question is, and it’s a question that probably comes from my low understanding of FFT, is the FFT peak amplitude supposed to be the same value as the max amplitude of the original signal? Or is it supposed to be something else? FFT is something that I’ve wrapped my head around only in the last few weeks for a uni project without really knowing much about it. Thank you in advance for you help. fft, signal processing MATLAB Answers — New Questions
How do I use multiple inputs in mexcuda?
I found a mexGPUExample.cu and compiled it successfully. In this file, there is only one input and one output. But I’d like to verify multiple inputs and single outputs. Changed codes are as below:
/*
* Example of how to use the mxGPUArray API in a MEX file. This example shows
* how to write a MEX function that takes a gpuArray input and returns a
* gpuArray output, e.g. B=mexFunction(A).
*
* Copyright 2012 The MathWorks, Inc.
*/
#include "mex.h"
#include "gpu/mxGPUArray.h"
#include "matrix.h"
/*
* Device code
*/
void __global__ TimesTwo(double const * const A, double const* const C, double * const B, int const N)
{
/* Calculate the global linear index, assuming a 1-d grid. */
int const i = blockDim.x * blockIdx.x + threadIdx.x;
if (i < N) {
B[i] = 2.0 * A[i];
B[i+N] = 2.0 * C[i];
}
}
/*
* Host code
*/
void mexFunction(int nlhs, mxArray *plhs[],
int nrhs, mxArray const *prhs[])
{
/* Declare all variables.*/
mxGPUArray const *A, *C;
mxGPUArray *B;
double const *d_A, *d_C;
double *d_B;
int N;
char const * const errId = "parallel:gpu:mexGPUExample:InvalidInput";
char const * const errMsg = "Invalid input to MEX file.";
/* Choose a reasonably sized number of threads for the block. */
int const threadsPerBlock = 256;
int blocksPerGrid;
/* Initialize the MathWorks GPU API. */
mxInitGPU();
/* Throw an error if the input is not a GPU array. */
if ((nrhs!=1) || !(mxIsGPUArray(prhs[0]))) {
mexErrMsgIdAndTxt(errId, errMsg);
}
A = mxGPUCreateFromMxArray(prhs[0]);
C = mxGPUCreateFromMxArray(prhs[1]);
/*
* Verify that A really is a double array before extracting the pointer.
*/
if (mxGPUGetClassID(A) != mxDOUBLE_CLASS) {
mexErrMsgIdAndTxt(errId, errMsg);
}
/*
* Now that we have verified the data type, extract a pointer to the input
* data on the device.
*/
d_A = (double const *)(mxGPUGetDataReadOnly(A));
d_C = (double const *)(mxGPUGetDataReadOnly(C));
/* Create a GPUArray to hold the result and get its underlying pointer. */
mwSize ndim = 2, dims[2] = {2,4};
B = mxGPUCreateGPUArray(ndim,
dims,
mxGPUGetClassID(A),
mxGPUGetComplexity(A),
MX_GPU_DO_NOT_INITIALIZE);
d_B = (double *)(mxGPUGetData(B));
/*
* Call the kernel using the CUDA runtime API. We are using a 1-d grid here,
* and it would be possible for the number of elements to be too large for
* the grid. For this example we are not guarding against this possibility.
*/
N = (int)(mxGPUGetNumberOfElements(A));
blocksPerGrid = (N + threadsPerBlock – 1) / threadsPerBlock;
TimesTwo<<<blocksPerGrid, threadsPerBlock>>>(d_A, d_C, d_B, N);
/* Wrap the result up as a MATLAB gpuArray for return. */
plhs[0] = mxGPUCreateMxArrayOnGPU(B);
/*
* The mxGPUArray pointers are host-side structures that refer to device
* data. These must be destroyed before leaving the MEX function.
*/
mxGPUDestroyGPUArray(A);
mxGPUDestroyGPUArray(B);
mxGPUDestroyGPUArray(C);
}
There is all changed codes.
And then I’ll type in matlab mexcuda xxx.cu, the matlab tell me compiled successfully. Then I provide two matrix and tansfer them to GPU. Finally, the question is typing xxx(data_gpu1,data_gpu2) will report an error: Invalid input to MEX file. I would like to know how to make xxx.cu recognize multiple inputs.I found a mexGPUExample.cu and compiled it successfully. In this file, there is only one input and one output. But I’d like to verify multiple inputs and single outputs. Changed codes are as below:
/*
* Example of how to use the mxGPUArray API in a MEX file. This example shows
* how to write a MEX function that takes a gpuArray input and returns a
* gpuArray output, e.g. B=mexFunction(A).
*
* Copyright 2012 The MathWorks, Inc.
*/
#include "mex.h"
#include "gpu/mxGPUArray.h"
#include "matrix.h"
/*
* Device code
*/
void __global__ TimesTwo(double const * const A, double const* const C, double * const B, int const N)
{
/* Calculate the global linear index, assuming a 1-d grid. */
int const i = blockDim.x * blockIdx.x + threadIdx.x;
if (i < N) {
B[i] = 2.0 * A[i];
B[i+N] = 2.0 * C[i];
}
}
/*
* Host code
*/
void mexFunction(int nlhs, mxArray *plhs[],
int nrhs, mxArray const *prhs[])
{
/* Declare all variables.*/
mxGPUArray const *A, *C;
mxGPUArray *B;
double const *d_A, *d_C;
double *d_B;
int N;
char const * const errId = "parallel:gpu:mexGPUExample:InvalidInput";
char const * const errMsg = "Invalid input to MEX file.";
/* Choose a reasonably sized number of threads for the block. */
int const threadsPerBlock = 256;
int blocksPerGrid;
/* Initialize the MathWorks GPU API. */
mxInitGPU();
/* Throw an error if the input is not a GPU array. */
if ((nrhs!=1) || !(mxIsGPUArray(prhs[0]))) {
mexErrMsgIdAndTxt(errId, errMsg);
}
A = mxGPUCreateFromMxArray(prhs[0]);
C = mxGPUCreateFromMxArray(prhs[1]);
/*
* Verify that A really is a double array before extracting the pointer.
*/
if (mxGPUGetClassID(A) != mxDOUBLE_CLASS) {
mexErrMsgIdAndTxt(errId, errMsg);
}
/*
* Now that we have verified the data type, extract a pointer to the input
* data on the device.
*/
d_A = (double const *)(mxGPUGetDataReadOnly(A));
d_C = (double const *)(mxGPUGetDataReadOnly(C));
/* Create a GPUArray to hold the result and get its underlying pointer. */
mwSize ndim = 2, dims[2] = {2,4};
B = mxGPUCreateGPUArray(ndim,
dims,
mxGPUGetClassID(A),
mxGPUGetComplexity(A),
MX_GPU_DO_NOT_INITIALIZE);
d_B = (double *)(mxGPUGetData(B));
/*
* Call the kernel using the CUDA runtime API. We are using a 1-d grid here,
* and it would be possible for the number of elements to be too large for
* the grid. For this example we are not guarding against this possibility.
*/
N = (int)(mxGPUGetNumberOfElements(A));
blocksPerGrid = (N + threadsPerBlock – 1) / threadsPerBlock;
TimesTwo<<<blocksPerGrid, threadsPerBlock>>>(d_A, d_C, d_B, N);
/* Wrap the result up as a MATLAB gpuArray for return. */
plhs[0] = mxGPUCreateMxArrayOnGPU(B);
/*
* The mxGPUArray pointers are host-side structures that refer to device
* data. These must be destroyed before leaving the MEX function.
*/
mxGPUDestroyGPUArray(A);
mxGPUDestroyGPUArray(B);
mxGPUDestroyGPUArray(C);
}
There is all changed codes.
And then I’ll type in matlab mexcuda xxx.cu, the matlab tell me compiled successfully. Then I provide two matrix and tansfer them to GPU. Finally, the question is typing xxx(data_gpu1,data_gpu2) will report an error: Invalid input to MEX file. I would like to know how to make xxx.cu recognize multiple inputs. I found a mexGPUExample.cu and compiled it successfully. In this file, there is only one input and one output. But I’d like to verify multiple inputs and single outputs. Changed codes are as below:
/*
* Example of how to use the mxGPUArray API in a MEX file. This example shows
* how to write a MEX function that takes a gpuArray input and returns a
* gpuArray output, e.g. B=mexFunction(A).
*
* Copyright 2012 The MathWorks, Inc.
*/
#include "mex.h"
#include "gpu/mxGPUArray.h"
#include "matrix.h"
/*
* Device code
*/
void __global__ TimesTwo(double const * const A, double const* const C, double * const B, int const N)
{
/* Calculate the global linear index, assuming a 1-d grid. */
int const i = blockDim.x * blockIdx.x + threadIdx.x;
if (i < N) {
B[i] = 2.0 * A[i];
B[i+N] = 2.0 * C[i];
}
}
/*
* Host code
*/
void mexFunction(int nlhs, mxArray *plhs[],
int nrhs, mxArray const *prhs[])
{
/* Declare all variables.*/
mxGPUArray const *A, *C;
mxGPUArray *B;
double const *d_A, *d_C;
double *d_B;
int N;
char const * const errId = "parallel:gpu:mexGPUExample:InvalidInput";
char const * const errMsg = "Invalid input to MEX file.";
/* Choose a reasonably sized number of threads for the block. */
int const threadsPerBlock = 256;
int blocksPerGrid;
/* Initialize the MathWorks GPU API. */
mxInitGPU();
/* Throw an error if the input is not a GPU array. */
if ((nrhs!=1) || !(mxIsGPUArray(prhs[0]))) {
mexErrMsgIdAndTxt(errId, errMsg);
}
A = mxGPUCreateFromMxArray(prhs[0]);
C = mxGPUCreateFromMxArray(prhs[1]);
/*
* Verify that A really is a double array before extracting the pointer.
*/
if (mxGPUGetClassID(A) != mxDOUBLE_CLASS) {
mexErrMsgIdAndTxt(errId, errMsg);
}
/*
* Now that we have verified the data type, extract a pointer to the input
* data on the device.
*/
d_A = (double const *)(mxGPUGetDataReadOnly(A));
d_C = (double const *)(mxGPUGetDataReadOnly(C));
/* Create a GPUArray to hold the result and get its underlying pointer. */
mwSize ndim = 2, dims[2] = {2,4};
B = mxGPUCreateGPUArray(ndim,
dims,
mxGPUGetClassID(A),
mxGPUGetComplexity(A),
MX_GPU_DO_NOT_INITIALIZE);
d_B = (double *)(mxGPUGetData(B));
/*
* Call the kernel using the CUDA runtime API. We are using a 1-d grid here,
* and it would be possible for the number of elements to be too large for
* the grid. For this example we are not guarding against this possibility.
*/
N = (int)(mxGPUGetNumberOfElements(A));
blocksPerGrid = (N + threadsPerBlock – 1) / threadsPerBlock;
TimesTwo<<<blocksPerGrid, threadsPerBlock>>>(d_A, d_C, d_B, N);
/* Wrap the result up as a MATLAB gpuArray for return. */
plhs[0] = mxGPUCreateMxArrayOnGPU(B);
/*
* The mxGPUArray pointers are host-side structures that refer to device
* data. These must be destroyed before leaving the MEX function.
*/
mxGPUDestroyGPUArray(A);
mxGPUDestroyGPUArray(B);
mxGPUDestroyGPUArray(C);
}
There is all changed codes.
And then I’ll type in matlab mexcuda xxx.cu, the matlab tell me compiled successfully. Then I provide two matrix and tansfer them to GPU. Finally, the question is typing xxx(data_gpu1,data_gpu2) will report an error: Invalid input to MEX file. I would like to know how to make xxx.cu recognize multiple inputs. mexcuda, mexfuctionexample MATLAB Answers — New Questions
Cannot start installer on Fedora Linux – symbol lookup error: UCNV_FROM_U_CALLBACK_ESCAPE_WITH_INVISIBLE_CHARS_72
I’m trying to install Matlab 2024a on Fedora Linux 38 and 39 without desktop environment and for both versions I’m getting error:
./install -inputFile installer_input.txt
matlab_R2024a_Linux/bin/glnxa64/MathWorksProductInstaller: matlab_R2024a_Linux/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.30′ not found (required by /lib64/libicuuc.so.72)
which can be solved by deleting bin/glnxa64/libstdc++.so.6.
After that I’m getting error about symbol lookup error:
./install -inputFile installer_input.txt
2024a/matlab_R2024a_Linux/bin/glnxa64/MathWorksProductInstaller: symbol lookup error: matlab_R2024a_Linux_Fedora/bin/glnxa64/libmwi18n.so: undefined symbol: UCNV_FROM_U_CALLBACK_ESCAPE_WITH_INVISIBLE_CHARS_72
Can it be solved or is it unsolvable incompatibility between system libs and Matlab ones?I’m trying to install Matlab 2024a on Fedora Linux 38 and 39 without desktop environment and for both versions I’m getting error:
./install -inputFile installer_input.txt
matlab_R2024a_Linux/bin/glnxa64/MathWorksProductInstaller: matlab_R2024a_Linux/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.30′ not found (required by /lib64/libicuuc.so.72)
which can be solved by deleting bin/glnxa64/libstdc++.so.6.
After that I’m getting error about symbol lookup error:
./install -inputFile installer_input.txt
2024a/matlab_R2024a_Linux/bin/glnxa64/MathWorksProductInstaller: symbol lookup error: matlab_R2024a_Linux_Fedora/bin/glnxa64/libmwi18n.so: undefined symbol: UCNV_FROM_U_CALLBACK_ESCAPE_WITH_INVISIBLE_CHARS_72
Can it be solved or is it unsolvable incompatibility between system libs and Matlab ones? I’m trying to install Matlab 2024a on Fedora Linux 38 and 39 without desktop environment and for both versions I’m getting error:
./install -inputFile installer_input.txt
matlab_R2024a_Linux/bin/glnxa64/MathWorksProductInstaller: matlab_R2024a_Linux/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.30′ not found (required by /lib64/libicuuc.so.72)
which can be solved by deleting bin/glnxa64/libstdc++.so.6.
After that I’m getting error about symbol lookup error:
./install -inputFile installer_input.txt
2024a/matlab_R2024a_Linux/bin/glnxa64/MathWorksProductInstaller: symbol lookup error: matlab_R2024a_Linux_Fedora/bin/glnxa64/libmwi18n.so: undefined symbol: UCNV_FROM_U_CALLBACK_ESCAPE_WITH_INVISIBLE_CHARS_72
Can it be solved or is it unsolvable incompatibility between system libs and Matlab ones? linux, fedora, symbol lookup error, installer, libmwi18n MATLAB Answers — New Questions
Events Segmentation in EEGLAB
Hello ! I am having an EEG data from more than 100 participants and it consist of 120 events. How can I segment the events into half as I am using eeglab script to process the data ? I want to analyze the first half and second half separately. Thanking you in anticipation.Hello ! I am having an EEG data from more than 100 participants and it consist of 120 events. How can I segment the events into half as I am using eeglab script to process the data ? I want to analyze the first half and second half separately. Thanking you in anticipation. Hello ! I am having an EEG data from more than 100 participants and it consist of 120 events. How can I segment the events into half as I am using eeglab script to process the data ? I want to analyze the first half and second half separately. Thanking you in anticipation. data segmentation, eeglab, erp MATLAB Answers — New Questions
Property with set observable attribute interrupts a current running callback when triggered
I have a drop down callback, which is actioned when the user selects one of the many options. Then this callback is triggered, but along the callback there is a code line where an app.property is assigned a new value, this property has as one of its attributes, the Set observable activated, then the code interrupts the first callback and move to run the listener callback of this app.property. Once this second callback (the listener callback) is finished, Matlab comes back to the earlier callback. But the thing is that I don’t want this to happen, cause the listener callbacks needs something from the first callback which is placed below the line of the property with the Setobservable atribute.
I have set, for the drop down callback, the "Interruptible property" to "off", and the "Busyactions property" to "cancel" as the Matlab documentation suggest (Matlab app designer pdf – page 11-15), but nothing happens.
Any idea what to do with this? I have googled this issue before to look for a similar one and nothing, that is why I rise this question.I have a drop down callback, which is actioned when the user selects one of the many options. Then this callback is triggered, but along the callback there is a code line where an app.property is assigned a new value, this property has as one of its attributes, the Set observable activated, then the code interrupts the first callback and move to run the listener callback of this app.property. Once this second callback (the listener callback) is finished, Matlab comes back to the earlier callback. But the thing is that I don’t want this to happen, cause the listener callbacks needs something from the first callback which is placed below the line of the property with the Setobservable atribute.
I have set, for the drop down callback, the "Interruptible property" to "off", and the "Busyactions property" to "cancel" as the Matlab documentation suggest (Matlab app designer pdf – page 11-15), but nothing happens.
Any idea what to do with this? I have googled this issue before to look for a similar one and nothing, that is why I rise this question. I have a drop down callback, which is actioned when the user selects one of the many options. Then this callback is triggered, but along the callback there is a code line where an app.property is assigned a new value, this property has as one of its attributes, the Set observable activated, then the code interrupts the first callback and move to run the listener callback of this app.property. Once this second callback (the listener callback) is finished, Matlab comes back to the earlier callback. But the thing is that I don’t want this to happen, cause the listener callbacks needs something from the first callback which is placed below the line of the property with the Setobservable atribute.
I have set, for the drop down callback, the "Interruptible property" to "off", and the "Busyactions property" to "cancel" as the Matlab documentation suggest (Matlab app designer pdf – page 11-15), but nothing happens.
Any idea what to do with this? I have googled this issue before to look for a similar one and nothing, that is why I rise this question. setobservable, interruptible, callback interruption, callback listener, matlab, app designer MATLAB Answers — New Questions
Finding MNF for every second inteval
Hello everyone! I’m currently trying to plot the MNF value from every 1 second interval of filtered signal. Here is the code I write:
%% MNF and MDF of signal
%Calculate MNF from every 1 s interval of the filtered signal
start = 0;
stop = 120;
%num_windows = floor(length(psd1) / fs);
interval=ceil((stop-start)/fs);
t_mnf = linspace(start,stop,interval+1);
mnf_s = zeros(1, interval+1);
for i=start:stop
% Check for starting index (avoid going below 1)
start_index = max(1, (i-1)*fs+1);
% Check for ending index (avoid exceeding psd1 length)
end_index = min(length(psd1), i*fs);
%Extract current window data by assuming 1 second window
window_data = psd1(start_index:end_index);
mnf_s(i-start+1)=meanfreq(window_data,fs);
end
figure(5)
plot(t,mnf_s,’-*k’)
xlabel(‘Time (s)’); ylabel(‘MNF (Hz)’)
title(‘MNF’)
The ‘psd1’ variable contains the PSD value of filtered signal. The code doesn’t work. Where could it went wrong?Hello everyone! I’m currently trying to plot the MNF value from every 1 second interval of filtered signal. Here is the code I write:
%% MNF and MDF of signal
%Calculate MNF from every 1 s interval of the filtered signal
start = 0;
stop = 120;
%num_windows = floor(length(psd1) / fs);
interval=ceil((stop-start)/fs);
t_mnf = linspace(start,stop,interval+1);
mnf_s = zeros(1, interval+1);
for i=start:stop
% Check for starting index (avoid going below 1)
start_index = max(1, (i-1)*fs+1);
% Check for ending index (avoid exceeding psd1 length)
end_index = min(length(psd1), i*fs);
%Extract current window data by assuming 1 second window
window_data = psd1(start_index:end_index);
mnf_s(i-start+1)=meanfreq(window_data,fs);
end
figure(5)
plot(t,mnf_s,’-*k’)
xlabel(‘Time (s)’); ylabel(‘MNF (Hz)’)
title(‘MNF’)
The ‘psd1’ variable contains the PSD value of filtered signal. The code doesn’t work. Where could it went wrong? Hello everyone! I’m currently trying to plot the MNF value from every 1 second interval of filtered signal. Here is the code I write:
%% MNF and MDF of signal
%Calculate MNF from every 1 s interval of the filtered signal
start = 0;
stop = 120;
%num_windows = floor(length(psd1) / fs);
interval=ceil((stop-start)/fs);
t_mnf = linspace(start,stop,interval+1);
mnf_s = zeros(1, interval+1);
for i=start:stop
% Check for starting index (avoid going below 1)
start_index = max(1, (i-1)*fs+1);
% Check for ending index (avoid exceeding psd1 length)
end_index = min(length(psd1), i*fs);
%Extract current window data by assuming 1 second window
window_data = psd1(start_index:end_index);
mnf_s(i-start+1)=meanfreq(window_data,fs);
end
figure(5)
plot(t,mnf_s,’-*k’)
xlabel(‘Time (s)’); ylabel(‘MNF (Hz)’)
title(‘MNF’)
The ‘psd1’ variable contains the PSD value of filtered signal. The code doesn’t work. Where could it went wrong? transferred MATLAB Answers — New Questions
Error when importing dll and header files using loadlibraryfunction, about #include
demo:
/*if not(libisloaded(‘ST_MarkDemo_CPP’))
loadlibrary(‘HM_Comm’,’HM_HashuScan.h’)
end
libfunctions(‘HM_HashuScan’);*/
erro:
‘E:X64ST_MarkDemo_CPP_V2.0ST_MarkDemo_CPPHM_HashuScan.h:2:18: fatal error: vector: No such
file or directory
#include <vector>
^
compilation terminated.
///The imported header file "HM_HashuScan.h" exists #include <vector> ;May be matlab can not compile how to solve?
Thanks in advance!demo:
/*if not(libisloaded(‘ST_MarkDemo_CPP’))
loadlibrary(‘HM_Comm’,’HM_HashuScan.h’)
end
libfunctions(‘HM_HashuScan’);*/
erro:
‘E:X64ST_MarkDemo_CPP_V2.0ST_MarkDemo_CPPHM_HashuScan.h:2:18: fatal error: vector: No such
file or directory
#include <vector>
^
compilation terminated.
///The imported header file "HM_HashuScan.h" exists #include <vector> ;May be matlab can not compile how to solve?
Thanks in advance! demo:
/*if not(libisloaded(‘ST_MarkDemo_CPP’))
loadlibrary(‘HM_Comm’,’HM_HashuScan.h’)
end
libfunctions(‘HM_HashuScan’);*/
erro:
‘E:X64ST_MarkDemo_CPP_V2.0ST_MarkDemo_CPPHM_HashuScan.h:2:18: fatal error: vector: No such
file or directory
#include <vector>
^
compilation terminated.
///The imported header file "HM_HashuScan.h" exists #include <vector> ;May be matlab can not compile how to solve?
Thanks in advance! dll, c++, loadlibrary MATLAB Answers — New Questions
How to extract the velocity from the differential equation and use the velocity to calculate the external excitations
Dear all,
I hope you are all doing well. I am using ode45 to sovle the differential equations without any external forces. It works well. However, I get problems in employing the external forces. Specifically, the forces should be relavant to the absolute value of the relative velocity of the wave and structure from the differential equations. I have no idea about how to using the velocity of each time step to calculate the force then apply the force to the structure (equations). My codes are following:
clear all; clc, close all
syms z_0 z_1
% ============ definition of the parameters ==============
% q1 = q_T tower… q2 = q_s surge… q3 = q_p platform pitch
rho = 1025; % kg/m3
g = 9.81;
H_T = 77.6; % m checked
h_R = 90; % m checked
h_T = 10; % m checked
h_G = 89.9155; % m checked
h_b = 30.0845; % m checked
h_BG = 62.69; % m
m_N = 110000+240000; % kg checked
m_T = 249718; % kg checked
m_p = 7446330; % kg checked
J_p = 4.22923e9; % kgm^2 checked
Z_1 = 10; % location of tower bottom
xi_TTFA = 0.01; % damping ratio of the tower
C_m = 1.969954; % checked
C_d = 0.6; % drag coefficient1
k1 = 41180; % N/m mooring stiffness in surge checked
k2 = -2.821*10^6; % N/rad mooring stiffness of coupled effect between surge and pitch
k3 = 3.111e8 -4.99918e9; % Nm/rad mooring stiffness in pitch motion3.111*10^8
c0 = 10^5; % N/(m/s) additional damping in surge checked
% q_s spar surge; q_p spar pitch; q_T TTFA deformation; q_TT TMD disp
% m_N the mass of RNA; m_TT the mass of TMD; m_p mass of spar
% m_T mass of the tower
% m_TTFA modal mass
% J_p inertia moment of spar
% h_R the undisturbed height of nacelle with reference to the MSL
% h_T the undisturbed distance between tower bottom and the MSL
% h_G the undisturbed distance from the MSL to the spar COG
% h_BG undisturbed vertical distance from the spar COG to the center of buoyancy (COB)
% h_b the distance between the platform bottom and the spar COG
% H_T the tower length
% z_1 the tower segment height in the local coordinate system
% z_1 the location of tower bottom
% z_0 the horizontal force acting at the spar location
% mu(z_1) the tower mass density per length
% Phi_TTFA(z_1) the fundamental mode shape of tower in the fore-aft
% k_TTFA bending stiffness of fore-aft displacement of tower
% C_m hydrodynamic inertia coefficients
tspan = 0:0.1:200;
X0 = [0 0 10*pi/180 0 0 0];
% ======================== definition of the tower =======================
mu = 0.093*z_1^2-42.18*z_1+4667; % mass per unit length ?
EI = -2.235e5*z_1^3+8.971e7*z_1^2-1.345e10*z_1+7.296e11;
% bending stiffness of the tower segment ?
Phi_TTFA = 0.8689*(z_1/H_T)^2+0.2205*(z_1/H_T)^3-0.0908*(z_1/H_T)^4+0.1167*(z_1/H_T)^5-0.1154*(z_1/H_T)^6;
% mass components
fun1 = mu*Phi_TTFA^2; m_TTFA = double(int(fun1,z_1,0,H_T)); % checked
fun2 = mu*Phi_TTFA; m_a = double(int(fun2,z_1,0,H_T)); % checked
fun3 = mu*(z_1+h_T)*Phi_TTFA; m_b = double(int(fun3,z_1,0,H_T)); % checked
fun4 = mu*(z_1+h_T); m_c = double(int(fun4,z_1,0,H_T)); % checked
fun5 = mu*(z_1+h_T).^2; m_d = double(int(fun5,z_1,0,H_T)); % checked
% bending stiffnes of the tower
D2y = diff(Phi_TTFA,z_1,2); Dy = diff(Phi_TTFA,z_1,1);
fun6 = EI*D2y^2; f1 = int(fun6,0,H_T);
fun7 = mu; f2 = int(fun7,z_1,H_T);
fun8 = g*(m_N+f2)*Dy^2; f3 = int(fun8,0,H_T);
k_TTFA = double(f1-f3);
% ============== definition of hydrodynamic properties ============
fun9 = @(z_0) diameter(z_0).^2;
fun10 = @(z_0) diameter(z_0).^2.*z_0;
fun11 = @(z_0) diameter(z_0).^2.*z_0.^2;
m_as = rho*(pi/4*(C_m-1)*integral(fun9,-h_b-h_G,0)); % added mass on surge motion
m_asp = rho*(pi/4*(C_m-1)*integral(fun10,-h_b-h_G,0)); % coupled added mass pitch, surge
m_ap = rho*(pi/4*(C_m-1)*integral(fun11,-h_b-h_G,0)); % added mass pitch
% ============== definition of matrices ==================
C_add = [0 0 0;
0 c0 0;
0 0 0];
M = [m_N+m_TTFA m_N+m_a (m_N*h_R+m_b);
m_N+m_a m_N+m_T+m_p m_N*h_R+m_c-m_p*h_G;
(m_N*h_R+m_b) m_N*h_R+m_c-m_p*h_G m_N*h_R^2+m_d+m_p*h_G^2+J_p];
M_hydro = [0 0 0;
0 m_as m_asp;
0 m_asp m_ap];
C = [2*xi_TTFA*sqrt(m_TTFA*k_TTFA) 0 0;
0 0 0;
0 0 0];
K = [k_TTFA 0 -(m_N+m_T)*g;
0 0 0;
-(m_N+m_T)*g 0 -(m_N*h_R+m_c-m_p*h_G)*g];
K_moor = [0 0 0;
0 k1 k2;
0 k2 k3];
% =============== solve the equations and plot the results =============
options = odeset(‘RelTol’,1e-10,’AbsTol’,1e-10);
[t,X] = ode45(@(t,X) odefn(tspan,t,X,M,M_hydro,C,C_add,K,K_moor),tspan,X0,options);
PtfmPitch_deg = X(:,3)*180/pi;
figure,
subplot(3,1,1), plot(t,X(:,1)),grid, xlabel(‘time/ s’), ylabel(‘TTDspFA/ m’)
subplot(3,1,2), plot(t,X(:,2)),grid, xlabel(‘time/ s’), ylabel(‘surge/ m’)
subplot(3,1,3), plot(t,PtfmPitch_deg),grid, xlabel(‘time/ s’), ylabel(‘platform pitch/ deg’)
% ================== definition of the equations =========================
function dXdt = odefn(t,tspan,X,M,M_hydro,C,C_add,K,K_moor)
syms z_0
rho = 1025; C_d = 0.6; h_G = 89.9155; % m checked
h_b = 30.0845; % m checked
dis = X(1:3)’;
vel = X(4:6)’; % get the velocity
% ================== definition of the drag force ========================
v_rel = – (vel(:,2) + vel(:,3) * z_0);
fun12 = @(z_0) diameter(z_0) * abs(v_rel);
fun13 = @(z_0) diameter(z_0) * z_0 * abs(v_rel);
c1 = double(1/2*rho*C_d*int(fun12,z_0,-h_b-h_G,0)); % Morison force1
c2 = double(1/2*rho*C_d*int(fun13,z_0,-h_b-h_G,0)); % Morison force2 force2
F1 = interp1(tspan,c1,t);
F2 = interp1(tspan,c2,t);
F = [0;F1;F2];
x = X(1:3);
xdot = X(4:6);
xddot = (M+M_hydro)(F-(K+K_moor)*x-(C+C_add)*xdot);
dXdt = [xdot; xddot];
end
% ============== definition of D(z) ===============================
function D=diameter(z_0)
D = (9.5).*(z_0<-12 & z_0>=-120)+((-0.3825)*z_0+4.59).*(z_0>=-12 & z_0<-4)+(6.5).*(z_0>=-4 & z_0<=0);
end
I appreciate your support.
Thank you.
Best wishes,
YuDear all,
I hope you are all doing well. I am using ode45 to sovle the differential equations without any external forces. It works well. However, I get problems in employing the external forces. Specifically, the forces should be relavant to the absolute value of the relative velocity of the wave and structure from the differential equations. I have no idea about how to using the velocity of each time step to calculate the force then apply the force to the structure (equations). My codes are following:
clear all; clc, close all
syms z_0 z_1
% ============ definition of the parameters ==============
% q1 = q_T tower… q2 = q_s surge… q3 = q_p platform pitch
rho = 1025; % kg/m3
g = 9.81;
H_T = 77.6; % m checked
h_R = 90; % m checked
h_T = 10; % m checked
h_G = 89.9155; % m checked
h_b = 30.0845; % m checked
h_BG = 62.69; % m
m_N = 110000+240000; % kg checked
m_T = 249718; % kg checked
m_p = 7446330; % kg checked
J_p = 4.22923e9; % kgm^2 checked
Z_1 = 10; % location of tower bottom
xi_TTFA = 0.01; % damping ratio of the tower
C_m = 1.969954; % checked
C_d = 0.6; % drag coefficient1
k1 = 41180; % N/m mooring stiffness in surge checked
k2 = -2.821*10^6; % N/rad mooring stiffness of coupled effect between surge and pitch
k3 = 3.111e8 -4.99918e9; % Nm/rad mooring stiffness in pitch motion3.111*10^8
c0 = 10^5; % N/(m/s) additional damping in surge checked
% q_s spar surge; q_p spar pitch; q_T TTFA deformation; q_TT TMD disp
% m_N the mass of RNA; m_TT the mass of TMD; m_p mass of spar
% m_T mass of the tower
% m_TTFA modal mass
% J_p inertia moment of spar
% h_R the undisturbed height of nacelle with reference to the MSL
% h_T the undisturbed distance between tower bottom and the MSL
% h_G the undisturbed distance from the MSL to the spar COG
% h_BG undisturbed vertical distance from the spar COG to the center of buoyancy (COB)
% h_b the distance between the platform bottom and the spar COG
% H_T the tower length
% z_1 the tower segment height in the local coordinate system
% z_1 the location of tower bottom
% z_0 the horizontal force acting at the spar location
% mu(z_1) the tower mass density per length
% Phi_TTFA(z_1) the fundamental mode shape of tower in the fore-aft
% k_TTFA bending stiffness of fore-aft displacement of tower
% C_m hydrodynamic inertia coefficients
tspan = 0:0.1:200;
X0 = [0 0 10*pi/180 0 0 0];
% ======================== definition of the tower =======================
mu = 0.093*z_1^2-42.18*z_1+4667; % mass per unit length ?
EI = -2.235e5*z_1^3+8.971e7*z_1^2-1.345e10*z_1+7.296e11;
% bending stiffness of the tower segment ?
Phi_TTFA = 0.8689*(z_1/H_T)^2+0.2205*(z_1/H_T)^3-0.0908*(z_1/H_T)^4+0.1167*(z_1/H_T)^5-0.1154*(z_1/H_T)^6;
% mass components
fun1 = mu*Phi_TTFA^2; m_TTFA = double(int(fun1,z_1,0,H_T)); % checked
fun2 = mu*Phi_TTFA; m_a = double(int(fun2,z_1,0,H_T)); % checked
fun3 = mu*(z_1+h_T)*Phi_TTFA; m_b = double(int(fun3,z_1,0,H_T)); % checked
fun4 = mu*(z_1+h_T); m_c = double(int(fun4,z_1,0,H_T)); % checked
fun5 = mu*(z_1+h_T).^2; m_d = double(int(fun5,z_1,0,H_T)); % checked
% bending stiffnes of the tower
D2y = diff(Phi_TTFA,z_1,2); Dy = diff(Phi_TTFA,z_1,1);
fun6 = EI*D2y^2; f1 = int(fun6,0,H_T);
fun7 = mu; f2 = int(fun7,z_1,H_T);
fun8 = g*(m_N+f2)*Dy^2; f3 = int(fun8,0,H_T);
k_TTFA = double(f1-f3);
% ============== definition of hydrodynamic properties ============
fun9 = @(z_0) diameter(z_0).^2;
fun10 = @(z_0) diameter(z_0).^2.*z_0;
fun11 = @(z_0) diameter(z_0).^2.*z_0.^2;
m_as = rho*(pi/4*(C_m-1)*integral(fun9,-h_b-h_G,0)); % added mass on surge motion
m_asp = rho*(pi/4*(C_m-1)*integral(fun10,-h_b-h_G,0)); % coupled added mass pitch, surge
m_ap = rho*(pi/4*(C_m-1)*integral(fun11,-h_b-h_G,0)); % added mass pitch
% ============== definition of matrices ==================
C_add = [0 0 0;
0 c0 0;
0 0 0];
M = [m_N+m_TTFA m_N+m_a (m_N*h_R+m_b);
m_N+m_a m_N+m_T+m_p m_N*h_R+m_c-m_p*h_G;
(m_N*h_R+m_b) m_N*h_R+m_c-m_p*h_G m_N*h_R^2+m_d+m_p*h_G^2+J_p];
M_hydro = [0 0 0;
0 m_as m_asp;
0 m_asp m_ap];
C = [2*xi_TTFA*sqrt(m_TTFA*k_TTFA) 0 0;
0 0 0;
0 0 0];
K = [k_TTFA 0 -(m_N+m_T)*g;
0 0 0;
-(m_N+m_T)*g 0 -(m_N*h_R+m_c-m_p*h_G)*g];
K_moor = [0 0 0;
0 k1 k2;
0 k2 k3];
% =============== solve the equations and plot the results =============
options = odeset(‘RelTol’,1e-10,’AbsTol’,1e-10);
[t,X] = ode45(@(t,X) odefn(tspan,t,X,M,M_hydro,C,C_add,K,K_moor),tspan,X0,options);
PtfmPitch_deg = X(:,3)*180/pi;
figure,
subplot(3,1,1), plot(t,X(:,1)),grid, xlabel(‘time/ s’), ylabel(‘TTDspFA/ m’)
subplot(3,1,2), plot(t,X(:,2)),grid, xlabel(‘time/ s’), ylabel(‘surge/ m’)
subplot(3,1,3), plot(t,PtfmPitch_deg),grid, xlabel(‘time/ s’), ylabel(‘platform pitch/ deg’)
% ================== definition of the equations =========================
function dXdt = odefn(t,tspan,X,M,M_hydro,C,C_add,K,K_moor)
syms z_0
rho = 1025; C_d = 0.6; h_G = 89.9155; % m checked
h_b = 30.0845; % m checked
dis = X(1:3)’;
vel = X(4:6)’; % get the velocity
% ================== definition of the drag force ========================
v_rel = – (vel(:,2) + vel(:,3) * z_0);
fun12 = @(z_0) diameter(z_0) * abs(v_rel);
fun13 = @(z_0) diameter(z_0) * z_0 * abs(v_rel);
c1 = double(1/2*rho*C_d*int(fun12,z_0,-h_b-h_G,0)); % Morison force1
c2 = double(1/2*rho*C_d*int(fun13,z_0,-h_b-h_G,0)); % Morison force2 force2
F1 = interp1(tspan,c1,t);
F2 = interp1(tspan,c2,t);
F = [0;F1;F2];
x = X(1:3);
xdot = X(4:6);
xddot = (M+M_hydro)(F-(K+K_moor)*x-(C+C_add)*xdot);
dXdt = [xdot; xddot];
end
% ============== definition of D(z) ===============================
function D=diameter(z_0)
D = (9.5).*(z_0<-12 & z_0>=-120)+((-0.3825)*z_0+4.59).*(z_0>=-12 & z_0<-4)+(6.5).*(z_0>=-4 & z_0<=0);
end
I appreciate your support.
Thank you.
Best wishes,
Yu Dear all,
I hope you are all doing well. I am using ode45 to sovle the differential equations without any external forces. It works well. However, I get problems in employing the external forces. Specifically, the forces should be relavant to the absolute value of the relative velocity of the wave and structure from the differential equations. I have no idea about how to using the velocity of each time step to calculate the force then apply the force to the structure (equations). My codes are following:
clear all; clc, close all
syms z_0 z_1
% ============ definition of the parameters ==============
% q1 = q_T tower… q2 = q_s surge… q3 = q_p platform pitch
rho = 1025; % kg/m3
g = 9.81;
H_T = 77.6; % m checked
h_R = 90; % m checked
h_T = 10; % m checked
h_G = 89.9155; % m checked
h_b = 30.0845; % m checked
h_BG = 62.69; % m
m_N = 110000+240000; % kg checked
m_T = 249718; % kg checked
m_p = 7446330; % kg checked
J_p = 4.22923e9; % kgm^2 checked
Z_1 = 10; % location of tower bottom
xi_TTFA = 0.01; % damping ratio of the tower
C_m = 1.969954; % checked
C_d = 0.6; % drag coefficient1
k1 = 41180; % N/m mooring stiffness in surge checked
k2 = -2.821*10^6; % N/rad mooring stiffness of coupled effect between surge and pitch
k3 = 3.111e8 -4.99918e9; % Nm/rad mooring stiffness in pitch motion3.111*10^8
c0 = 10^5; % N/(m/s) additional damping in surge checked
% q_s spar surge; q_p spar pitch; q_T TTFA deformation; q_TT TMD disp
% m_N the mass of RNA; m_TT the mass of TMD; m_p mass of spar
% m_T mass of the tower
% m_TTFA modal mass
% J_p inertia moment of spar
% h_R the undisturbed height of nacelle with reference to the MSL
% h_T the undisturbed distance between tower bottom and the MSL
% h_G the undisturbed distance from the MSL to the spar COG
% h_BG undisturbed vertical distance from the spar COG to the center of buoyancy (COB)
% h_b the distance between the platform bottom and the spar COG
% H_T the tower length
% z_1 the tower segment height in the local coordinate system
% z_1 the location of tower bottom
% z_0 the horizontal force acting at the spar location
% mu(z_1) the tower mass density per length
% Phi_TTFA(z_1) the fundamental mode shape of tower in the fore-aft
% k_TTFA bending stiffness of fore-aft displacement of tower
% C_m hydrodynamic inertia coefficients
tspan = 0:0.1:200;
X0 = [0 0 10*pi/180 0 0 0];
% ======================== definition of the tower =======================
mu = 0.093*z_1^2-42.18*z_1+4667; % mass per unit length ?
EI = -2.235e5*z_1^3+8.971e7*z_1^2-1.345e10*z_1+7.296e11;
% bending stiffness of the tower segment ?
Phi_TTFA = 0.8689*(z_1/H_T)^2+0.2205*(z_1/H_T)^3-0.0908*(z_1/H_T)^4+0.1167*(z_1/H_T)^5-0.1154*(z_1/H_T)^6;
% mass components
fun1 = mu*Phi_TTFA^2; m_TTFA = double(int(fun1,z_1,0,H_T)); % checked
fun2 = mu*Phi_TTFA; m_a = double(int(fun2,z_1,0,H_T)); % checked
fun3 = mu*(z_1+h_T)*Phi_TTFA; m_b = double(int(fun3,z_1,0,H_T)); % checked
fun4 = mu*(z_1+h_T); m_c = double(int(fun4,z_1,0,H_T)); % checked
fun5 = mu*(z_1+h_T).^2; m_d = double(int(fun5,z_1,0,H_T)); % checked
% bending stiffnes of the tower
D2y = diff(Phi_TTFA,z_1,2); Dy = diff(Phi_TTFA,z_1,1);
fun6 = EI*D2y^2; f1 = int(fun6,0,H_T);
fun7 = mu; f2 = int(fun7,z_1,H_T);
fun8 = g*(m_N+f2)*Dy^2; f3 = int(fun8,0,H_T);
k_TTFA = double(f1-f3);
% ============== definition of hydrodynamic properties ============
fun9 = @(z_0) diameter(z_0).^2;
fun10 = @(z_0) diameter(z_0).^2.*z_0;
fun11 = @(z_0) diameter(z_0).^2.*z_0.^2;
m_as = rho*(pi/4*(C_m-1)*integral(fun9,-h_b-h_G,0)); % added mass on surge motion
m_asp = rho*(pi/4*(C_m-1)*integral(fun10,-h_b-h_G,0)); % coupled added mass pitch, surge
m_ap = rho*(pi/4*(C_m-1)*integral(fun11,-h_b-h_G,0)); % added mass pitch
% ============== definition of matrices ==================
C_add = [0 0 0;
0 c0 0;
0 0 0];
M = [m_N+m_TTFA m_N+m_a (m_N*h_R+m_b);
m_N+m_a m_N+m_T+m_p m_N*h_R+m_c-m_p*h_G;
(m_N*h_R+m_b) m_N*h_R+m_c-m_p*h_G m_N*h_R^2+m_d+m_p*h_G^2+J_p];
M_hydro = [0 0 0;
0 m_as m_asp;
0 m_asp m_ap];
C = [2*xi_TTFA*sqrt(m_TTFA*k_TTFA) 0 0;
0 0 0;
0 0 0];
K = [k_TTFA 0 -(m_N+m_T)*g;
0 0 0;
-(m_N+m_T)*g 0 -(m_N*h_R+m_c-m_p*h_G)*g];
K_moor = [0 0 0;
0 k1 k2;
0 k2 k3];
% =============== solve the equations and plot the results =============
options = odeset(‘RelTol’,1e-10,’AbsTol’,1e-10);
[t,X] = ode45(@(t,X) odefn(tspan,t,X,M,M_hydro,C,C_add,K,K_moor),tspan,X0,options);
PtfmPitch_deg = X(:,3)*180/pi;
figure,
subplot(3,1,1), plot(t,X(:,1)),grid, xlabel(‘time/ s’), ylabel(‘TTDspFA/ m’)
subplot(3,1,2), plot(t,X(:,2)),grid, xlabel(‘time/ s’), ylabel(‘surge/ m’)
subplot(3,1,3), plot(t,PtfmPitch_deg),grid, xlabel(‘time/ s’), ylabel(‘platform pitch/ deg’)
% ================== definition of the equations =========================
function dXdt = odefn(t,tspan,X,M,M_hydro,C,C_add,K,K_moor)
syms z_0
rho = 1025; C_d = 0.6; h_G = 89.9155; % m checked
h_b = 30.0845; % m checked
dis = X(1:3)’;
vel = X(4:6)’; % get the velocity
% ================== definition of the drag force ========================
v_rel = – (vel(:,2) + vel(:,3) * z_0);
fun12 = @(z_0) diameter(z_0) * abs(v_rel);
fun13 = @(z_0) diameter(z_0) * z_0 * abs(v_rel);
c1 = double(1/2*rho*C_d*int(fun12,z_0,-h_b-h_G,0)); % Morison force1
c2 = double(1/2*rho*C_d*int(fun13,z_0,-h_b-h_G,0)); % Morison force2 force2
F1 = interp1(tspan,c1,t);
F2 = interp1(tspan,c2,t);
F = [0;F1;F2];
x = X(1:3);
xdot = X(4:6);
xddot = (M+M_hydro)(F-(K+K_moor)*x-(C+C_add)*xdot);
dXdt = [xdot; xddot];
end
% ============== definition of D(z) ===============================
function D=diameter(z_0)
D = (9.5).*(z_0<-12 & z_0>=-120)+((-0.3825)*z_0+4.59).*(z_0>=-12 & z_0<-4)+(6.5).*(z_0>=-4 & z_0<=0);
end
I appreciate your support.
Thank you.
Best wishes,
Yu ode45, differential equations MATLAB Answers — New Questions
Using MATLAB to do Numerical Differentiation
Given: A piecewise function where v(t)=70t @ t<=20s & 1596.2-9.81t @ 20<t<=t_max <—(eq 1)
Also given: s(t)=35t^2+7620 @ t<=20s & 1596.2t-4.905t^2-8342 @ 20<t<=t_max <—(eq 2)
Find: For figure 3 I need to plot my velocity as a function of time, (the same thing I did in figure 1), only this time I need to add an additional line which is the derivative approximation of velocity. I’ll use circle markers for my approximation at every 10th point wtih no line. This is to show that my line for the derivative approximation should be nearly identical to my equation line.
My Solution:
%% Finding Value of tmax
% Finding tmax and rounding it to the nearest whole number
%%
tmaxr=roots([-9.81, 1596.2]);
tmax=ceil(tmaxr);
%% Plotting Equation 1
% Creating Figure 1 from Equation 1
%%
t=0:0.1:tmax;
v=zeros(size(t));
for N=1:length(t)
if t(N)<=20
v(N)=70*t(N);
else
v(N)=1596.2-9.81*t(N); % Only valid for t > 20 seconds
end
end
figure(1)
plot(t,v)
xlabel(‘Time (s)’)
ylabel(‘Velocity (m/s)’)
title(‘Velocity vs. Time’)
%% Plotting Equation 2
% Creating Figure 2 from Equation 2
%%
t=0:0.1:tmax;
s=zeros(size(t));
for N=1:length(t)
if t(N)<=20
s(N)=35.*t(N).^2+7620;
else
s(N)=1596.2.*t(N)-4.905.*t(N).^2-8342;
end
end
figure(2)
plot(t,s)
xlabel(‘Time (s)’)
ylabel(‘Altitude (m)’)
title(‘Position vs. Time’)
Issue: So I have the above code which I believe to be correct but not sure of how to get the derivative approximation…Given: A piecewise function where v(t)=70t @ t<=20s & 1596.2-9.81t @ 20<t<=t_max <—(eq 1)
Also given: s(t)=35t^2+7620 @ t<=20s & 1596.2t-4.905t^2-8342 @ 20<t<=t_max <—(eq 2)
Find: For figure 3 I need to plot my velocity as a function of time, (the same thing I did in figure 1), only this time I need to add an additional line which is the derivative approximation of velocity. I’ll use circle markers for my approximation at every 10th point wtih no line. This is to show that my line for the derivative approximation should be nearly identical to my equation line.
My Solution:
%% Finding Value of tmax
% Finding tmax and rounding it to the nearest whole number
%%
tmaxr=roots([-9.81, 1596.2]);
tmax=ceil(tmaxr);
%% Plotting Equation 1
% Creating Figure 1 from Equation 1
%%
t=0:0.1:tmax;
v=zeros(size(t));
for N=1:length(t)
if t(N)<=20
v(N)=70*t(N);
else
v(N)=1596.2-9.81*t(N); % Only valid for t > 20 seconds
end
end
figure(1)
plot(t,v)
xlabel(‘Time (s)’)
ylabel(‘Velocity (m/s)’)
title(‘Velocity vs. Time’)
%% Plotting Equation 2
% Creating Figure 2 from Equation 2
%%
t=0:0.1:tmax;
s=zeros(size(t));
for N=1:length(t)
if t(N)<=20
s(N)=35.*t(N).^2+7620;
else
s(N)=1596.2.*t(N)-4.905.*t(N).^2-8342;
end
end
figure(2)
plot(t,s)
xlabel(‘Time (s)’)
ylabel(‘Altitude (m)’)
title(‘Position vs. Time’)
Issue: So I have the above code which I believe to be correct but not sure of how to get the derivative approximation… Given: A piecewise function where v(t)=70t @ t<=20s & 1596.2-9.81t @ 20<t<=t_max <—(eq 1)
Also given: s(t)=35t^2+7620 @ t<=20s & 1596.2t-4.905t^2-8342 @ 20<t<=t_max <—(eq 2)
Find: For figure 3 I need to plot my velocity as a function of time, (the same thing I did in figure 1), only this time I need to add an additional line which is the derivative approximation of velocity. I’ll use circle markers for my approximation at every 10th point wtih no line. This is to show that my line for the derivative approximation should be nearly identical to my equation line.
My Solution:
%% Finding Value of tmax
% Finding tmax and rounding it to the nearest whole number
%%
tmaxr=roots([-9.81, 1596.2]);
tmax=ceil(tmaxr);
%% Plotting Equation 1
% Creating Figure 1 from Equation 1
%%
t=0:0.1:tmax;
v=zeros(size(t));
for N=1:length(t)
if t(N)<=20
v(N)=70*t(N);
else
v(N)=1596.2-9.81*t(N); % Only valid for t > 20 seconds
end
end
figure(1)
plot(t,v)
xlabel(‘Time (s)’)
ylabel(‘Velocity (m/s)’)
title(‘Velocity vs. Time’)
%% Plotting Equation 2
% Creating Figure 2 from Equation 2
%%
t=0:0.1:tmax;
s=zeros(size(t));
for N=1:length(t)
if t(N)<=20
s(N)=35.*t(N).^2+7620;
else
s(N)=1596.2.*t(N)-4.905.*t(N).^2-8342;
end
end
figure(2)
plot(t,s)
xlabel(‘Time (s)’)
ylabel(‘Altitude (m)’)
title(‘Position vs. Time’)
Issue: So I have the above code which I believe to be correct but not sure of how to get the derivative approximation… plotting, calculus MATLAB Answers — New Questions
Windows Server 2012 manual patching
Hello Team,
I have 2 new servers – Windows Server 2016 standard and Windows 2012 R2 standard.
I need to install security patches manualy(download from interenet, copy and install) as there is no access to internet and we don’t have any patching tool.
For Windows 2016 standard I will install latest Cumulative Update and the latest Service Stack Update. I think it is enough.
But what about Windows Server 2012 R2 standard? Which security patches should I install to have this server up-to-date?
Thank you in advance for help.
Hello Team,I have 2 new servers – Windows Server 2016 standard and Windows 2012 R2 standard.I need to install security patches manualy(download from interenet, copy and install) as there is no access to internet and we don’t have any patching tool.For Windows 2016 standard I will install latest Cumulative Update and the latest Service Stack Update. I think it is enough.But what about Windows Server 2012 R2 standard? Which security patches should I install to have this server up-to-date?Thank you in advance for help. Read More
Copilot for 3rd party system – Advice needed
I am currently working on creating a Copilot intended to be used as a tool for employees to access and retrieve information about customers and the insurances they have in a 3rd party, non-Microsoft, system.
I’m struggling with finding information about some functionalities and best practices and would greatly appreciate your advice:
The insurances, customer, and claims are queryable via an API and events on a service bus upon changes – we do not have access to the databaseThe insurances need to be correlated with the corresponding terms & conditions, which are available in PDFs in a blob-store or Sharepoint.Depending on if it is a customer, or a internal administrator, only the relevant insurances/claims-data should be part of the dataset included in the responseIf an insurance is created for a customer, it should be part of the dataset “near realtime”.
A quick response time is crucial, which means pre-indexing data is a necessity.
Ideally, the Copilot should operate swiftly and accurately, but I am also tasked with creating a solution that is easy to set up and maintain. We’re deciding between using Copilot and AI Studio.
What would be the easiest way to implement this, and what would be the best way?
Thank you,
Malin
I am currently working on creating a Copilot intended to be used as a tool for employees to access and retrieve information about customers and the insurances they have in a 3rd party, non-Microsoft, system. I’m struggling with finding information about some functionalities and best practices and would greatly appreciate your advice: The insurances, customer, and claims are queryable via an API and events on a service bus upon changes – we do not have access to the databaseThe insurances need to be correlated with the corresponding terms & conditions, which are available in PDFs in a blob-store or Sharepoint.Depending on if it is a customer, or a internal administrator, only the relevant insurances/claims-data should be part of the dataset included in the responseIf an insurance is created for a customer, it should be part of the dataset “near realtime”.A quick response time is crucial, which means pre-indexing data is a necessity. Ideally, the Copilot should operate swiftly and accurately, but I am also tasked with creating a solution that is easy to set up and maintain. We’re deciding between using Copilot and AI Studio.What would be the easiest way to implement this, and what would be the best way?Thank you,Malin Read More
Unable to fetch more than 5000 records from filtered view
I have a SharePoint List and created filtered views of the list which contains more than 5000 records . I tried to retrieve the records and getting an error like “The attempted operation is prohibited because it exceeds the list view threshold”. Can anyone help me to get data using pagination like batch by batch in loop? If possible share the code snippet for python.
I have a SharePoint List and created filtered views of the list which contains more than 5000 records . I tried to retrieve the records and getting an error like “The attempted operation is prohibited because it exceeds the list view threshold”. Can anyone help me to get data using pagination like batch by batch in loop? If possible share the code snippet for python. Read More
How to change SP online site domain
Hi,
I wanted to change SP online domain url from https://contoso.sharepoint.com to https://contoso.com
please suggest if need any higher license or anyhow possible?
Thanks,
Deepak
Hi,I wanted to change SP online domain url from https://contoso.sharepoint.com to https://contoso.complease suggest if need any higher license or anyhow possible? Thanks,Deepak Read More
Different meeting stage for host and guest
Environment: teams web and desktop (new version 1415/24031414721), asp core 6, third party cookies
host = user that starts teams app, logs in (authenticates) and invokes shareAppContentToStage
guest = all others users
1. manifest loads sidebar via manifest config (for example configurationURL: https://test.de/sidebar)
2. sidebar contains Login button with authenticates against https://test.de/login
3. sucessfull Login (cookie authentication) in iFrame => sidebar will redirected to https://test.de/host
4. javascript of host calls “microsoftTeams.meeting.shareAppContentToStage(handleShareScreenAction, `https://test.de/guestorhost`);”
5. endpoint /guestorhost checks if request is authenticated (in this example only user with sidebar logged in)
5.1 If request authenticated => redirect to ‘https://test.de/hoststage‘
5.2 If request NOT authenticated => redirect to ‘https://test.de/gueststage‘
Expected result: host should always get /hoststage, guest should always get /gueststage
Current result: sometimes it is working probably, sometimes host gets /gueststage or nothing
My guess is that third party cookies is not working stable and sometimes they are send and sometimes not.
Environment: teams web and desktop (new version 1415/24031414721), asp core 6, third party cookies host = user that starts teams app, logs in (authenticates) and invokes shareAppContentToStageguest = all others users 1. manifest loads sidebar via manifest config (for example configurationURL: https://test.de/sidebar)2. sidebar contains Login button with authenticates against https://test.de/login3. sucessfull Login (cookie authentication) in iFrame => sidebar will redirected to https://test.de/host4. javascript of host calls “microsoftTeams.meeting.shareAppContentToStage(handleShareScreenAction, `https://test.de/guestorhost`);”5. endpoint /guestorhost checks if request is authenticated (in this example only user with sidebar logged in) 5.1 If request authenticated => redirect to ‘https://test.de/hoststage’ 5.2 If request NOT authenticated => redirect to ‘https://test.de/gueststage’Expected result: host should always get /hoststage, guest should always get /gueststageCurrent result: sometimes it is working probably, sometimes host gets /gueststage or nothing My guess is that third party cookies is not working stable and sometimes they are send and sometimes not. Read More
Microsoft Store latest changes with app downloads
Just wondering if any other IT admins are dealing with the recent changes to the Microsoft Store app downloads and how instead of launching the full MS Store, it now launches a containerized version. While this does lead to a better user experience, the unfortunate side effect is it bypasses our current restriction to block the MS Store from users.
We currently control all our MS Store apps in Intune via the Company Portal and have the policy to “block MS Store” enabled. However, the change where you can download the apps via a self contained EXE on the website now bypasses this block, presumably because the containerized version of the app installer is not referencing any of these policies.
Can Microsoft please address this? We don’t really want to block apps.microsoft.com but if this behavior isn’t changed this might be the end result.
Just wondering if any other IT admins are dealing with the recent changes to the Microsoft Store app downloads and how instead of launching the full MS Store, it now launches a containerized version. While this does lead to a better user experience, the unfortunate side effect is it bypasses our current restriction to block the MS Store from users. We currently control all our MS Store apps in Intune via the Company Portal and have the policy to “block MS Store” enabled. However, the change where you can download the apps via a self contained EXE on the website now bypasses this block, presumably because the containerized version of the app installer is not referencing any of these policies. Can Microsoft please address this? We don’t really want to block apps.microsoft.com but if this behavior isn’t changed this might be the end result. Read More
Why comments are not imported into Planner from Trello with apps4.Pro?
Hello, I am using the apps4.pro tool to transfer content from my team’s Trello to a new Planner plan. Every time I do this with the administrator, the comments that were made on Trello are not imported into Planner even though the tool’s documentation confirms that the comments will also be transferred. We exported the Trello cards with all their content into a JSON file which is normally supported by apps4.Pro. In the JSON file, comments are correctly saved in the JSON file exported from Trello and are accessible via a key named “text”. Is there a particular format for Planner to recognize and import comments?
Hello, I am using the apps4.pro tool to transfer content from my team’s Trello to a new Planner plan. Every time I do this with the administrator, the comments that were made on Trello are not imported into Planner even though the tool’s documentation confirms that the comments will also be transferred. We exported the Trello cards with all their content into a JSON file which is normally supported by apps4.Pro. In the JSON file, comments are correctly saved in the JSON file exported from Trello and are accessible via a key named “text”. Is there a particular format for Planner to recognize and import comments? Read More