Month: September 2024
Error using odearguments Vector Length issue
I am not sure I understand the issue here. Any help would be appreciated
%% Initial Variables
s1=0.27; s2=1.04; s3=0.716; s4=0; s5=0; Vref=1.04; Pref=0.716;
%% Define Diferential Equations
function dsdt= pv_system(t,s)
%parameters
Ki=20; Kp=4; Kip=10; Kiq=10; Tr=0.02; TGpv=0.01; Rq=0; Rp=0.05;
Vref=1.04; Qactual=0.27; Vt=1.04;Pref=0.716;DeltaOmega=0;Pactual=0.716;
Qcmd =0.27;
%State Variables
s1=s(1); s2=s(2); s3=(s); s4=s(4); s5=s(4);
%diferential Equations
ds1dt=Ki*(Vref-s2-Rq*Qactual);
ds2dt = (1 / Tr) * (Vt – s2);
ds3dt = (1 / TGpv) * (Pref – (DeltaOmega / Rp) – s3);
ds4dt = Kip * (s3 – Pactual);
ds5dt = Kiq * (Qcmd – Qactual);
dsdt = [ds1dt; ds2dt; ds3dt; ds4dt; ds5dt];
end
%% inital Vector
s0 = [s1;s2;s3;s4;s5];
%% Time span for simulation
tspan = [0 10]; % 0 to 10 seconds
%% Solve using ode45
[t, s] = ode45(@pv_system, tspan, s0);I am not sure I understand the issue here. Any help would be appreciated
%% Initial Variables
s1=0.27; s2=1.04; s3=0.716; s4=0; s5=0; Vref=1.04; Pref=0.716;
%% Define Diferential Equations
function dsdt= pv_system(t,s)
%parameters
Ki=20; Kp=4; Kip=10; Kiq=10; Tr=0.02; TGpv=0.01; Rq=0; Rp=0.05;
Vref=1.04; Qactual=0.27; Vt=1.04;Pref=0.716;DeltaOmega=0;Pactual=0.716;
Qcmd =0.27;
%State Variables
s1=s(1); s2=s(2); s3=(s); s4=s(4); s5=s(4);
%diferential Equations
ds1dt=Ki*(Vref-s2-Rq*Qactual);
ds2dt = (1 / Tr) * (Vt – s2);
ds3dt = (1 / TGpv) * (Pref – (DeltaOmega / Rp) – s3);
ds4dt = Kip * (s3 – Pactual);
ds5dt = Kiq * (Qcmd – Qactual);
dsdt = [ds1dt; ds2dt; ds3dt; ds4dt; ds5dt];
end
%% inital Vector
s0 = [s1;s2;s3;s4;s5];
%% Time span for simulation
tspan = [0 10]; % 0 to 10 seconds
%% Solve using ode45
[t, s] = ode45(@pv_system, tspan, s0); I am not sure I understand the issue here. Any help would be appreciated
%% Initial Variables
s1=0.27; s2=1.04; s3=0.716; s4=0; s5=0; Vref=1.04; Pref=0.716;
%% Define Diferential Equations
function dsdt= pv_system(t,s)
%parameters
Ki=20; Kp=4; Kip=10; Kiq=10; Tr=0.02; TGpv=0.01; Rq=0; Rp=0.05;
Vref=1.04; Qactual=0.27; Vt=1.04;Pref=0.716;DeltaOmega=0;Pactual=0.716;
Qcmd =0.27;
%State Variables
s1=s(1); s2=s(2); s3=(s); s4=s(4); s5=s(4);
%diferential Equations
ds1dt=Ki*(Vref-s2-Rq*Qactual);
ds2dt = (1 / Tr) * (Vt – s2);
ds3dt = (1 / TGpv) * (Pref – (DeltaOmega / Rp) – s3);
ds4dt = Kip * (s3 – Pactual);
ds5dt = Kiq * (Qcmd – Qactual);
dsdt = [ds1dt; ds2dt; ds3dt; ds4dt; ds5dt];
end
%% inital Vector
s0 = [s1;s2;s3;s4;s5];
%% Time span for simulation
tspan = [0 10]; % 0 to 10 seconds
%% Solve using ode45
[t, s] = ode45(@pv_system, tspan, s0); ode45 MATLAB Answers — New Questions
MacBook mail is not working even after removing the account
I already tried removing the account but it continues giving error in the password
I already tried removing the account but it continues giving error in the password Read More
Display content (page, List) based on condition
In Sharepoint online, how can I display or hide an object (page, list etc.) based on a role or group membership or any other value?
Basically display the content based on a condition.
In Sharepoint online, how can I display or hide an object (page, list etc.) based on a role or group membership or any other value?Basically display the content based on a condition. Read More
Newton Forward difference method
% Confirmed case Sample data points (x, y)
data = [ 1, 88; 2, 49; 3, 47; 4, 8; 5, 34; 6, 762; 7, 98; 8, 40];
% Extract x and y values
x = data(:, 1);
y = data(:, 2);
n = length(x);
% Calculate forward differences
forward_diff = zeros(n, n);
forward_diff(:, 1) = y;
for j = 2:n
for i = 1:n-j+1
forward_diff(i, j) = forward_diff(i+1, j-1) – forward_diff(i, j-1);
end
end
% Construct the Newton Forward Difference polynomial
syms X;
P = y(1);
for j = 1:n-1
term = forward_diff(1, j);
for i = 1:j
term = term * (X – x(i));
end
P = P + term / factorial(j);
end
disp(‘Newton Forward Difference Polynomial:’);
disp(simplify(P));
Result Newton Forward Difference Polynomial: – (725*X^7)/1008 + (1651*X^6)/80 – (173233*X^5)/720 + (70651*X^4)/48 – (91321*X^3)/18 + (146407*X^2)/15 – (1996741*X)/210 + 3658
The problem now is that when I substitute each value of x, I don’t get the corresponding value of y as stated in the table. I need help on how to get the correct polynomial equation.% Confirmed case Sample data points (x, y)
data = [ 1, 88; 2, 49; 3, 47; 4, 8; 5, 34; 6, 762; 7, 98; 8, 40];
% Extract x and y values
x = data(:, 1);
y = data(:, 2);
n = length(x);
% Calculate forward differences
forward_diff = zeros(n, n);
forward_diff(:, 1) = y;
for j = 2:n
for i = 1:n-j+1
forward_diff(i, j) = forward_diff(i+1, j-1) – forward_diff(i, j-1);
end
end
% Construct the Newton Forward Difference polynomial
syms X;
P = y(1);
for j = 1:n-1
term = forward_diff(1, j);
for i = 1:j
term = term * (X – x(i));
end
P = P + term / factorial(j);
end
disp(‘Newton Forward Difference Polynomial:’);
disp(simplify(P));
Result Newton Forward Difference Polynomial: – (725*X^7)/1008 + (1651*X^6)/80 – (173233*X^5)/720 + (70651*X^4)/48 – (91321*X^3)/18 + (146407*X^2)/15 – (1996741*X)/210 + 3658
The problem now is that when I substitute each value of x, I don’t get the corresponding value of y as stated in the table. I need help on how to get the correct polynomial equation. % Confirmed case Sample data points (x, y)
data = [ 1, 88; 2, 49; 3, 47; 4, 8; 5, 34; 6, 762; 7, 98; 8, 40];
% Extract x and y values
x = data(:, 1);
y = data(:, 2);
n = length(x);
% Calculate forward differences
forward_diff = zeros(n, n);
forward_diff(:, 1) = y;
for j = 2:n
for i = 1:n-j+1
forward_diff(i, j) = forward_diff(i+1, j-1) – forward_diff(i, j-1);
end
end
% Construct the Newton Forward Difference polynomial
syms X;
P = y(1);
for j = 1:n-1
term = forward_diff(1, j);
for i = 1:j
term = term * (X – x(i));
end
P = P + term / factorial(j);
end
disp(‘Newton Forward Difference Polynomial:’);
disp(simplify(P));
Result Newton Forward Difference Polynomial: – (725*X^7)/1008 + (1651*X^6)/80 – (173233*X^5)/720 + (70651*X^4)/48 – (91321*X^3)/18 + (146407*X^2)/15 – (1996741*X)/210 + 3658
The problem now is that when I substitute each value of x, I don’t get the corresponding value of y as stated in the table. I need help on how to get the correct polynomial equation. newton forward difference method MATLAB Answers — New Questions
Changing Specific Highlight Colors in Microsoft Word Without Affecting Others
Hello Everyone,
I have text highlighted in multiple colors (green, yellow, and blue), and I want to change only the blue highlights to yellow without affecting the green highlights.
Thanks,
Hello Everyone, I have text highlighted in multiple colors (green, yellow, and blue), and I want to change only the blue highlights to yellow without affecting the green highlights. Thanks, Read More
Gauss-Seidel for solving linear equations
Apply 4 iterations, by the Gauss-Seidel iterative method, to solve the system of linear equations,Check the solutions by matrix calculation.Apply 4 iterations, by the Gauss-Seidel iterative method, to solve the system of linear equations,Check the solutions by matrix calculation. Apply 4 iterations, by the Gauss-Seidel iterative method, to solve the system of linear equations,Check the solutions by matrix calculation. gauss-seidel MATLAB Answers — New Questions
How to find the parameters of Fraction order PID Controller?
I want to design a FOPID controller. I’ve been gone through a lot of documents and paper works but I can’t find about how to find the values of Kp, Ki, Kd, λ and μ. Can anyone suggest a website, idea or even codes to find the tuning parameters? My transfer function is 40/(7.5s + 1)I want to design a FOPID controller. I’ve been gone through a lot of documents and paper works but I can’t find about how to find the values of Kp, Ki, Kd, λ and μ. Can anyone suggest a website, idea or even codes to find the tuning parameters? My transfer function is 40/(7.5s + 1) I want to design a FOPID controller. I’ve been gone through a lot of documents and paper works but I can’t find about how to find the values of Kp, Ki, Kd, λ and μ. Can anyone suggest a website, idea or even codes to find the tuning parameters? My transfer function is 40/(7.5s + 1) fopid, pid, fractional order pid MATLAB Answers — New Questions
MS BOOKINGS- Shared bookings
The person who originally set up up our shared booking page no longer works for the company. She has removed herself as an Administrator but continues to get emails when customers cancel their appointments. I’ve checked every place possible and can’t find her email anywhere so I’m confused why this is happening. Is there anyway to stop emails from going to the original Administrator who set up the shared bookings page for our company or do we need to create a new shared booking page?
The person who originally set up up our shared booking page no longer works for the company. She has removed herself as an Administrator but continues to get emails when customers cancel their appointments. I’ve checked every place possible and can’t find her email anywhere so I’m confused why this is happening. Is there anyway to stop emails from going to the original Administrator who set up the shared bookings page for our company or do we need to create a new shared booking page? Read More
Account Recovery Not Working
I recently lost access to my email and my recovery email, and the phones on both accounts are both old phone numbers I have changed. I know some of my old passwords and other information which can be used to identify the owner of the account i’m trying to get back, but every time that I complete the account recovery form which is a form that asks for one’s full name, past passwords, Skype names, and things of that sort. I have never gotten an email from Microsoft Outlook about whether if the account recovery was successful. Is there something I am doing wrong? The email I am trying to recover is a Hotmail email
I recently lost access to my email and my recovery email, and the phones on both accounts are both old phone numbers I have changed. I know some of my old passwords and other information which can be used to identify the owner of the account i’m trying to get back, but every time that I complete the account recovery form which is a form that asks for one’s full name, past passwords, Skype names, and things of that sort. I have never gotten an email from Microsoft Outlook about whether if the account recovery was successful. Is there something I am doing wrong? The email I am trying to recover is a Hotmail email Read More
Which versions of Xilinx System Generator (now AMD Vitis Model Composer) support which MATLAB release?
Which versions of Xilinx System Generator for DSP / AMD Vitis Model Composer are compatible with which versions of MATLAB?Which versions of Xilinx System Generator for DSP / AMD Vitis Model Composer are compatible with which versions of MATLAB? Which versions of Xilinx System Generator for DSP / AMD Vitis Model Composer are compatible with which versions of MATLAB? xilinx, sysgen, compatibility, support MATLAB Answers — New Questions
using Gauss Jacobi method to solve a system of equations
I’m new to Matlab so don’t have the best understanding here, i need to use the jacobi method to find the values of C but i dont really know the code that i need to use.
My equations are:
(837*C3)/2000 – (6851*C2)/10000 – (1091*C1)/2500 – (821*C4)/2000
(1337*C1)/2000 + (437*C2)/2500 + (3899*C3)/10000 – (6087*C4)/10000
(1601*C2)/2500 – (2939*C1)/5000 – (477*C3)/10000 – (4921*C4)/10000
(1313*C1)/10000 – (3*C2)/10 – (8209*C3)/10000 – (292*C4)/625
A = [-0.4364 -0.6851 0.4185 -0.4105; 0.6685 0.1748 0.3899 -0.6087; -0.5878 0.6404 -0.0477 -0.4921; 0.1313 -0.3000 -0.8209 -0.4672];
B = [0;40;0;0];
please note that this is not diaganally dominant but ive been told to do it anyway – it is part of an assignment.
cheers.I’m new to Matlab so don’t have the best understanding here, i need to use the jacobi method to find the values of C but i dont really know the code that i need to use.
My equations are:
(837*C3)/2000 – (6851*C2)/10000 – (1091*C1)/2500 – (821*C4)/2000
(1337*C1)/2000 + (437*C2)/2500 + (3899*C3)/10000 – (6087*C4)/10000
(1601*C2)/2500 – (2939*C1)/5000 – (477*C3)/10000 – (4921*C4)/10000
(1313*C1)/10000 – (3*C2)/10 – (8209*C3)/10000 – (292*C4)/625
A = [-0.4364 -0.6851 0.4185 -0.4105; 0.6685 0.1748 0.3899 -0.6087; -0.5878 0.6404 -0.0477 -0.4921; 0.1313 -0.3000 -0.8209 -0.4672];
B = [0;40;0;0];
please note that this is not diaganally dominant but ive been told to do it anyway – it is part of an assignment.
cheers. I’m new to Matlab so don’t have the best understanding here, i need to use the jacobi method to find the values of C but i dont really know the code that i need to use.
My equations are:
(837*C3)/2000 – (6851*C2)/10000 – (1091*C1)/2500 – (821*C4)/2000
(1337*C1)/2000 + (437*C2)/2500 + (3899*C3)/10000 – (6087*C4)/10000
(1601*C2)/2500 – (2939*C1)/5000 – (477*C3)/10000 – (4921*C4)/10000
(1313*C1)/10000 – (3*C2)/10 – (8209*C3)/10000 – (292*C4)/625
A = [-0.4364 -0.6851 0.4185 -0.4105; 0.6685 0.1748 0.3899 -0.6087; -0.5878 0.6404 -0.0477 -0.4921; 0.1313 -0.3000 -0.8209 -0.4672];
B = [0;40;0;0];
please note that this is not diaganally dominant but ive been told to do it anyway – it is part of an assignment.
cheers. matlab, gauss jacobi MATLAB Answers — New Questions
Excel chart
Hi ,
I can’t seem to be able to insert chart in my excel sheet . I have the Microsoft 365. Please help
Hi , I can’t seem to be able to insert chart in my excel sheet . I have the Microsoft 365. Please help Read More
IF Formula Help Please
Hello bit of a beginner here. Please can anyone tell me if what I am trying to achieve is possible in excel. I feel like everything is if you just know how!
I am creating a spreadsheet where there will moments in column A where there is an entry that reads “ONO”. Whenever this happens the cell in column B next to it will read “For [whatever is in Column A in the row above]”.
I am trying to automate this so that whenever Column A has “ONO”, then Column B for that row will autofill. Otherwise it will do nothing and entries will be manual.
My attempt was =IF(A2=”ONO”,”For””A1″,””)
This comes back as wrong. Please can anyone help?
Hello bit of a beginner here. Please can anyone tell me if what I am trying to achieve is possible in excel. I feel like everything is if you just know how!I am creating a spreadsheet where there will moments in column A where there is an entry that reads “ONO”. Whenever this happens the cell in column B next to it will read “For [whatever is in Column A in the row above]”. I am trying to automate this so that whenever Column A has “ONO”, then Column B for that row will autofill. Otherwise it will do nothing and entries will be manual. My attempt was =IF(A2=”ONO”,”For””A1″,””)This comes back as wrong. Please can anyone help? Read More
Feature Request: Enhanced system restore UI like virtualization software
Hi Microsoft dev community,
I insist implementing functionality to take snapshot/restore actual hard drive
system restore restores pc back in time in case of issues but not as user friendly as any virtualization software like vmware
Just as virtualization software there can be a more advanced version of system restore application where there will be UI for:
1. taking snapshot of current state
2. option to list snapshots
3. restore any snapshot back in time
Maybe based on Hyper-V,
Maybe this feature already there but I have not found it
originally posted here: https://superuser.com/q/1855140/86839
Hi Microsoft dev community, I insist implementing functionality to take snapshot/restore actual hard drivesystem restore restores pc back in time in case of issues but not as user friendly as any virtualization software like vmware Just as virtualization software there can be a more advanced version of system restore application where there will be UI for:1. taking snapshot of current state2. option to list snapshots3. restore any snapshot back in time Maybe based on Hyper-V,Maybe this feature already there but I have not found it originally posted here: https://superuser.com/q/1855140/86839 Read More
Pdf and url icon
Hello
In the latest versions of Canary, the icons for .pdf and .url are broken (white)
I found to put back the pdf icons but not for the url (creation of a shortcut for example)
If anyone has an idea, while waiting for the bug to be fixed
Thanks
Hello In the latest versions of Canary, the icons for .pdf and .url are broken (white)I found to put back the pdf icons but not for the url (creation of a shortcut for example)If anyone has an idea, while waiting for the bug to be fixedThanks Read More
This Co-Pilot page is blocking my access to use my email for work.
How can I get past this **bleep** Co-Pilot page. I need to access my email for work and can’t get to it because this thing I don’t even need is blocking it.
How can I get past this **bleep** Co-Pilot page. I need to access my email for work and can’t get to it because this thing I don’t even need is blocking it. Read More
Changing channel from the Dev to Beta.
I don’t know why it is grey and not selectable but others like canary and release preview are selectable. But these are unstable hence I wanted to move back to beta channel. I also approached from get help but no solution was found from their side also. So I request here to is there anybody who can help me in sorting out this problem?
I don’t know why it is grey and not selectable but others like canary and release preview are selectable. But these are unstable hence I wanted to move back to beta channel. I also approached from get help but no solution was found from their side also. So I request here to is there anybody who can help me in sorting out this problem? Read More
Matlab not reading data fast enough from arduino.
My code is able to read data from the serial port correctly (it seems), however for some reason my dataIndex variable is not keeping up with the speed that I am trying to read data at (I think). While I should have 10000 data points using this code my dataIndex variable is ending at way short at about 816 instead. Has anybody else ever had an issue like this?
Another but not as important issue I have been having is this occassional error code:
Warning: Matching failure in format. The format specified for conversion, ‘%d’, is incorrect.
Unable to perform assignment because the left and right sides have a different number of elements.
It only comes up sometimes, and it seems like its because my value variable occasionally becomes a char.
Any advice that could be offered on any of this would be greatly appreciated!
%% Matlab code
clc;
clear;
close all;
% % Closes serial ports
fclose(instrfind());
% % Defines serial connection
arduino = serial(‘COM11′,’BaudRate’,9600);
% % Initializes serial connection
fopen(arduino);
% % Duration to record data(in seconds).
duration = 10;
% % Time interval between consecutive data reads.
stepTime = .001;
% % Total number of data samples to be recorded.
samples = duration/stepTime;
% % Initialize arrays for storing data and timestamps.
valueArray = zeros(1,samples);
dataIndex = 1;
tObj = tic;
while(toc(tObj) <= duration)
% % Gets data value from serial port
value = fscanf(arduino,’%d’);
% % Store the read data in the corresponding data array.
valueArray(dataIndex) = value;
dataIndex = dataIndex + 1;
% % Read data from Arduino pins in intervals specified by the variable ‘stepTime’.
pause(stepTime);
end
% % Closes serial ports
fclose(instrfind());
%% Arduino code
const int analogInPin = A0;
int sensorValue = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(analogInPin);
Serial.println(sensorValue);
delay(10);
}My code is able to read data from the serial port correctly (it seems), however for some reason my dataIndex variable is not keeping up with the speed that I am trying to read data at (I think). While I should have 10000 data points using this code my dataIndex variable is ending at way short at about 816 instead. Has anybody else ever had an issue like this?
Another but not as important issue I have been having is this occassional error code:
Warning: Matching failure in format. The format specified for conversion, ‘%d’, is incorrect.
Unable to perform assignment because the left and right sides have a different number of elements.
It only comes up sometimes, and it seems like its because my value variable occasionally becomes a char.
Any advice that could be offered on any of this would be greatly appreciated!
%% Matlab code
clc;
clear;
close all;
% % Closes serial ports
fclose(instrfind());
% % Defines serial connection
arduino = serial(‘COM11′,’BaudRate’,9600);
% % Initializes serial connection
fopen(arduino);
% % Duration to record data(in seconds).
duration = 10;
% % Time interval between consecutive data reads.
stepTime = .001;
% % Total number of data samples to be recorded.
samples = duration/stepTime;
% % Initialize arrays for storing data and timestamps.
valueArray = zeros(1,samples);
dataIndex = 1;
tObj = tic;
while(toc(tObj) <= duration)
% % Gets data value from serial port
value = fscanf(arduino,’%d’);
% % Store the read data in the corresponding data array.
valueArray(dataIndex) = value;
dataIndex = dataIndex + 1;
% % Read data from Arduino pins in intervals specified by the variable ‘stepTime’.
pause(stepTime);
end
% % Closes serial ports
fclose(instrfind());
%% Arduino code
const int analogInPin = A0;
int sensorValue = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(analogInPin);
Serial.println(sensorValue);
delay(10);
} My code is able to read data from the serial port correctly (it seems), however for some reason my dataIndex variable is not keeping up with the speed that I am trying to read data at (I think). While I should have 10000 data points using this code my dataIndex variable is ending at way short at about 816 instead. Has anybody else ever had an issue like this?
Another but not as important issue I have been having is this occassional error code:
Warning: Matching failure in format. The format specified for conversion, ‘%d’, is incorrect.
Unable to perform assignment because the left and right sides have a different number of elements.
It only comes up sometimes, and it seems like its because my value variable occasionally becomes a char.
Any advice that could be offered on any of this would be greatly appreciated!
%% Matlab code
clc;
clear;
close all;
% % Closes serial ports
fclose(instrfind());
% % Defines serial connection
arduino = serial(‘COM11′,’BaudRate’,9600);
% % Initializes serial connection
fopen(arduino);
% % Duration to record data(in seconds).
duration = 10;
% % Time interval between consecutive data reads.
stepTime = .001;
% % Total number of data samples to be recorded.
samples = duration/stepTime;
% % Initialize arrays for storing data and timestamps.
valueArray = zeros(1,samples);
dataIndex = 1;
tObj = tic;
while(toc(tObj) <= duration)
% % Gets data value from serial port
value = fscanf(arduino,’%d’);
% % Store the read data in the corresponding data array.
valueArray(dataIndex) = value;
dataIndex = dataIndex + 1;
% % Read data from Arduino pins in intervals specified by the variable ‘stepTime’.
pause(stepTime);
end
% % Closes serial ports
fclose(instrfind());
%% Arduino code
const int analogInPin = A0;
int sensorValue = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(analogInPin);
Serial.println(sensorValue);
delay(10);
} arduino, serial, char MATLAB Answers — New Questions
How to add a 2D plot to an existing 3D plot by sharing the same axes?
Dear Matlab Community,
I am wondering how to replicate a plot that I have seen in a journal paper. The 3D plot can be created using various functions (mesh, contour3, surf etc.) but I am unable to add another plot in a way that they both use the same axes? Has anyone come across a solution for this?Dear Matlab Community,
I am wondering how to replicate a plot that I have seen in a journal paper. The 3D plot can be created using various functions (mesh, contour3, surf etc.) but I am unable to add another plot in a way that they both use the same axes? Has anyone come across a solution for this? Dear Matlab Community,
I am wondering how to replicate a plot that I have seen in a journal paper. The 3D plot can be created using various functions (mesh, contour3, surf etc.) but I am unable to add another plot in a way that they both use the same axes? Has anyone come across a solution for this? contour3, 3d plots MATLAB Answers — New Questions