Skip to main content

Posts

Showing posts from March, 2022

Stretch the dynamic range of the given 8-bit grayscale image using MATL...

GPU and CPU code: How to do?

  I would like to share my MATLAB project with others that does not have any GPU card in your computers, but I want to use the GPU power in my computer.   How can I write  ONLY ONE MATLAB  code that can be run with and without GPU system?   My main GPU commands are: parfor GPUarray In C/C++ language, we can write a pre-processor that can be this "magic shift". Is possible to do this in MATLAB? NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research. Depending on how your codes are structured, try to decide early on whether to use gpuArray or regular array. Most Matlab built-in functions will automatically determine and use gpuArrays.     function Output = main(Input) %Decide ear

How can I use LSTM networks to solve a time series regression problem?

  How can I use LSTM networks to solve a time series regression problem? I would like to train a LSTM regression network using all but the last 10 time steps and then test it to see how well the model has done using the last 10 steps of time series that were not used in the training. NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research. To forecast the values of future time steps of a sequence, you can train a sequence-to-sequence regression LSTM network, where the responses are the training sequences with values shifted by one time step. That is, at each time step of the input sequence, the LSTM network learns to predict the value of the next time step. Please refer to the attached ex

How many arithmetic operations does matlab require to determine the Schur decomposition?

  Consider a matrix A of size n.   I would like to determine the square root of this matrix which can be done like this: n = 10; % variable size A = rand(n); % random square matrix A of size n by n A_sqrt = sqrtm(A); % square root of matrix A Inside the sqrtm command, matlab requires the Schur decomposition for determining the square root of a matrix. [S, T] = schur(A); % with A = S*T*S and S*S' = I and T = (quassi) upper triangular matrix To determine the speed of sqrtm, I would like an expression of the amount of required distinguisable operations (summation, subtraction, multiplication, division and square root) expressed in the matrix size n. To get this expression, I would like to know how Matlab determines the Schur decomposition of a matrix.   I read that the first step is to determine the upper Hessenberg form H by means of [G,H] = hess(A); % with A = G*H*G' and G*G' = I After this, a QR decomposition of H is executed [Q,R] = qr(H); % with H = Q*R and Q*Q' = I

sdmag evaluation by bode instruction

  Hi everyone, could someone explain me how the sdmag parameter is calculated from the following statement? Thanks in advance.     [mag,phase,wout,sdmag,sdphase] = bode(sys,w);   NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research. Those are only calculated for  identified  systems.   If you edit the  bode.m  here (to simply look through rather than edit the code): C:\Program Files\MATLAB\R2018b\toolbox\shared\controllib\engine\@DynamicSystem\bode.m % Shadowed DynamicSystem method you will find that it then refers to  magphaseresp_.m  and from there to  freqresp.m , that among other outputs returns  ‘covH’ , the covariance of the frequency response of the identified model. That appea

I have curve fitted an histogram using the gaussian function

  Hi, I have curve fitted an histogram using the gaussian function. Now I would like to know how to extract a series of cell diameters from the gaussian fit.  Histogram with curve fit (x = cell diamters y = frequency)   NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research. Check The Code: clc; clear all; close all; BW = imread('../resources/images/gaussianfitqa3.png'); [nr,nc,layers] = size(BW); %% converting the image to 2d so the image can be labledd %% if layers>1 BW = BW(:,:,1); end % end of lablling %%%%%%%%%%%%%%%%% binaryimage = BW < 128; bw = logical(binaryimage); imwrite(bw, 'imagetoapp.jpg'); %% lablelling the image %%%%%% [labeledimage, numberofbl

How can I design a PID Controller to stabllize the plant 1/(s^3+1) ?

  I have a system, it's Transfer function is :   1 ------------ s^3 + 1   and I want to design a Discrete PID Controller so discretized the plant at sampling time 0.05s : 0.000019z^2 + 0.00008z + 0.000021   ------------------------------------------------- (Sorry, it is not clean..) z^3 -2.99994z^2 + 3.00006z - 1   This system is unstable and Discrete PID Controller Block's autotuner cannot find Kp, Ki, Kd to stablize the system. I want to design a PID Controller, not another Controller.   I think it should be added such a filter, derivative filter(Differtiator?) or a Integrator...   How can I design the PID Controller in Matlab and Simulink? It can be designed? NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with sourc

Nodal basis function 1D

  Hello all, I coded a nodal basis function for 1D element from [-1,1]. the code is below:   close all; clc; clearvars; n=10; x = linspace(-1,1,n); for i=1:n a= x(i); for j=1:n b(j)=a.^(j-1); end v(i,:)=b'; end vinv=inv(v); for i=1:n k=zeros(1,n); k(i)=1; f=vinv*k' p(:,i)=f; end for i=1:n g=@(x) p(1,i)+p(2,i).*x+p(3,i).*x.^2+p(4,i).*x.^3+p(5,i).*x.^4+p(6,i).*x.^5+p(7,i).*x.^6+p(8,i).*x.^7+p(9,i).*x.^8+ .... p(10,i).*x.^9; legendInfo{i} = ['Phi ' num2str(i)]; fplot(g, [-1 1]) legend(legendInfo) hold on; end The code works already but my problem is in last "for loop" where I calculated "g" as a function handle. I want to instead of adding the terms from 1 to 10, use an automated calculation. Now, if I want to change number of nodes (n) from 10 to 20 I have to add 10 additional terms by hand. Moreover, Does somebody knows a better way to calculate nodal basis function for 1D element? NOTE:- Matla

Is there a better way of solving simultaneous differential

  Is there a better way of solving simultaneous differential equations then using dsolve as MATLAB crashes everytime I use it?   So I have a set of simulataneous differential equtions that need to be solved as such:     Ive been using this code but as stated in the title MATLAB crashes is there any better way of doing this: clear clc syms P1(t) P2(t) P3(t) P4(t) P5(t) P6(t) P7(t) P8(t)... Lam1 Lam2 Lam3 Mu1 Mu2 Mu3 % Typing in all the equations eqns = ... [diff(P1,t) == (-Lam1-Lam2-Lam3)*P1 + (Mu1)*P2 + (Mu2)*P3 + (Mu3)*P4,... diff(P2,t) == (Lam1)*P1 + (-Mu1-Lam2-Lam3)*P2 + (Mu2)*P5 + (Mu3)*P6,... diff(P3,t) == (Lam2)*P1 + (-Mu2-Lam1-Lam3)*P3 + (Mu1)*P5 + (Mu3)*P7,... diff(P4,t) == (Lam3)*P1 + (-Mu3-Lam1-Lam2)*P4 + (Mu1)*P6 + (Mu2)*P7,... diff(P5,t) == (Lam2)*P2 + (Lam1)*P3 + (-Mu1-Mu2-Lam3)*P5 + (Mu3)*P8,... diff(P6,t) == (Lam3)*P2 + (Lam1)*P4 + (-Mu1-Mu3-Lam2)*P6 + (Mu2)*P8,... diff(P7,t) == (Lam3)*P3 + (Lam2)*P4 + (-Mu2-Mu3-Lam1)*P7 + (Mu1)*P8,...

Adjust the phase offset when using data from 'bode'

  I'm trying to look at the phase and gain margin of an openloop system. Due to presentation/publications, I had to designa function to plot my amplitude and phase response with good font, font dimensions etc. To do so, I'm using the bode function to extract the data from my state space systems. But I have a problem with a phase offset (value at 0Hz). I know we can remove it from the properties editor avalaible in the classical bode plot but is there a solution to correct it when using this syntax  [mag,phase,wout] = bode(sys,w)  ? NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research. if you want - as you write - stick to the bode output you should correct the phase by a refere

linearize a model with symbolic entries in Gains, Constants and other blocks

  I have built a matlab-script to linearize a gate-turbine-generator modell around a specific operation point.   To create a general model, I have tried to use symbolics (syms) in the Simulink model, but while linearize is running I receive some error:   Error using symbolisch (line 5)   Invalid setting in 'dAP_sym/Plant/Constant6' for parameter 'Value'.   or   Invalid setting in 'dAP_sym/Plant/Gain1' for parameter 'Gain'.   Do I need a additional command to use symbols in Simulink?? NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research. Symbolic variables cannot be used as Simulink signals. The only way to use symbolic variables in Simulink is to create